Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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!
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Oracle Database Administration The Essential Reference

Authors: Brian Laskey, David Kreines

1st Edition

1565925165, 978-1565925168

More Books

Students also viewed these Databases questions

Question

Influences on Nonverbal Communication?

Answered: 1 week ago