Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Question 1 4 pts Suppose you have solved a dynamic programming algorithm and come up with the following two variable recurrence: OPT OPT ( i

Question 1
4 pts
Suppose you have solved a dynamic programming algorithm and
come up with the following two variable recurrence:
OPT 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 (}1,0)=0\mathrm{ and OPT (e,j)=0 for al1 i,j For 1=1,2,, n, n:Return OPT(n,n)
\
FindOPT_b(n,m)=ElseIf (m =0): Return e Return max{ A(n)+ FindOPT_b(n-1,n-1), FindOPT_b(n-1,n)}
FindOPT_c():For }1=1,2,\ldots,n\mathrm{ : Let OPT((1,j)=\operatorname{max}{A(i)+\operatorname{OPT}(1-1,j-1),\operatorname{OPT}(i-1,j)}FindOPT_d():For }\textrm{j}=1,2,\ldots,\textrm{n}\mathrm{ : Let OPT(i,j)=\operatorname{max}{A(i)+\operatorname{OPT}(i-1,j-1),\operatorname{OPT}(i-1,j)}
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_2

Step: 3

blur-text-image_3

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

Inductive Databases And Constraint Based Data Mining

Authors: Saso Dzeroski ,Bart Goethals ,Pance Panov

2010th Edition

1489982175, 978-1489982179

More Books

Students also viewed these Databases questions

Question

What is meant by time-series data? Give an example.

Answered: 1 week ago