Question: Suppose you have solved a dynamic programming algorithm and come up with the following two variable recurrence: OPT ( i , j ) = max

Suppose you have solved a dynamic programming algorithm and come up with the following two variable recurrence:
OPT(i,j)=max{A(i)+OPT(i-1,j-1),OPT(i-1,j)}
for i=0,1,dots,n and j=0,1,dots,m, with base cases OPT(0,j)=0 and OPT(i,0)=0. In this recurrence, A is some array representing the input to the problem. In all of
the code snippets, A will be a global variable.
Each of the following pseudocode snippets represents an attempt at a polynomial time algorithm for efficiently and correctly computing the value OPT(n,m). For
each pseudocode snippet, answer "true" if it correctly computes OPT(i,j) in polynomial time and "false" if it fails to do so.Let OPT (i,0)=0 and OPT (0,j)=0 for all i,j For i =1,2,,., n:FindOPT_b(n,m):ElseIf (m =0): Return 0 Return max{ A(n)+ FindOPT_b(n-1,m-1), FindOPT_b(n-1,m)}
FindOPT_c():For i =1,2,\ldots, n:Return OPT( n,m)
FindOPT_d():For j =1,2,\ldots, m: Let OPT(i,j)=\operatorname{max}{A(i)+OPT(i-1,j-1), OPT(i-1,j)}
Mainly confused on the last one. Thank you!
 Suppose you have solved a dynamic programming algorithm and come up

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!