0if j-w 0 and F[i,0] = 0 for i > 02.1)Solve the knapsack instance given below using the recurrence given above.Apply the dynamic programming to the following instance of the knapsack problem where...


Consider the knapsack problem: given n items of known weights w,., w, and values v,., v, and<br>a knapsack of capacity W, find the most valuable subset of the items that fit int the knapcak . In order to<br>design a dynamic programming algorithm, we have driven the recurrence relation below that expresses a<br>solution to an instance of the knapsack problem in terms of solutions to its smaller subinstances. For 1<isn<br>and 1< j<W the value of F[i, j] is as follows:<br>F[i, j] =<br>smax { F[i – 1, j], vị + F[i – 1, j – w;] } if j-w; > 0<br>if j-w < 0<br>F[i – 1, j]<br>and we define the initial conditions as follows: F[0,j] = 0 for j>0 and F[i,0] = 0 for i > 0<br>2.1)<br>Solve the knapsack instance given below using the recurrence given above.<br>Apply the dynamic programming to the following instance of the knapsack problem where the capacity<br>W = 4. Fill out the cells in the table using the recurrence given. You will not receive any credit if you do<br>not use the recurrence relation. Write your results to the table below.<br>сараcity j<br>item<br>weight<br>i<br>1<br>2<br>3<br>value<br>$25<br>$22<br>1<br>1<br>2<br>2<br>25<br>25<br>25<br>25<br>$26<br>$27<br>3<br>1<br>25<br>25<br>47<br>47<br>4<br>26<br>51<br>4<br>26<br>i = 3 j= 3<br>F[3,3] =<br>i = 3 j= 4<br>F[3,4] =<br>i = 4 j = 2<br>F[4, 2] =<br>i = 4 j= 3<br>F[4, 3] =<br>i = 4 j= 4<br>F[4, 4] =<br>1.<br>2.<br>3.<br>

Extracted text: Consider the knapsack problem: given n items of known weights w,., w, and values v,., v, and a knapsack of capacity W, find the most valuable subset of the items that fit int the knapcak . In order to design a dynamic programming algorithm, we have driven the recurrence relation below that expresses a solution to an instance of the knapsack problem in terms of solutions to its smaller subinstances. For 1<> 0 if j-w < 0="" f[i="" –="" 1,="" j]="" and="" we="" define="" the="" initial="" conditions="" as="" follows:="" f[0,j]="0" for="" j="">0 and F[i,0] = 0 for i > 0 2.1) Solve the knapsack instance given below using the recurrence given above. Apply the dynamic programming to the following instance of the knapsack problem where the capacity W = 4. Fill out the cells in the table using the recurrence given. You will not receive any credit if you do not use the recurrence relation. Write your results to the table below. сараcity j item weight i 1 2 3 value $25 $22 1 1 2 2 25 25 25 25 $26 $27 3 1 25 25 47 47 4 26 51 4 26 i = 3 j= 3 F[3,3] = i = 3 j= 4 F[3,4] = i = 4 j = 2 F[4, 2] = i = 4 j= 3 F[4, 3] = i = 4 j= 4 F[4, 4] = 1. 2. 3.
Jun 11, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here