This question is for dynamic programming algorithms – Java.Please explain clearly. Thank You!
Here is the example mentioned from above.
Question 1 (20 pts): For the following 0/1 knapsack problem, Item Value of itemi Weight of item i 1 2 2 3 3 5 Find the optimal value by filling out the table as discussed in class (you can find an example table in the course note “course notes 12 dynamic programming”, search for DP-figure 1). The capacity of the knapsack is 6. 1. Here is the table for you to fill (15 pts): valueſi.w| 2. Based on your table, what is the optimal value for this problem (5 pts)? Answer: Show DP-figure-1. Let W = 10 and i Vi w; 1 2 10 40 5 4 3 4 30 50 6 3 0 1 2 0 0 0 0 0 0 1 0 0 0 0 0 2 0 0 0 0 0 3 0 0 0 0 50 4 0 0 40 40 50 5 6 7 8 0 0 0 0 10 10 10 10 40 40 40 40 40 40 40 40 50 50 90 90 9 0 10 50 50 90 10 0 10 50 70 90 Show transcribed image text Question 1 (20 pts): For the following 0/1 knapsack problem, Item Value of itemi Weight of item i 1 2 2 3 3 5 Find the optimal value by filling out the table as discussed in class (you can find an example table in the course note “course notes 12 dynamic programming”, search for DP-figure 1). The capacity of the knapsack is 6. 1. Here is the table for you to fill (15 pts): valueſi.w| 2. Based on your table, what is the optimal value for this problem (5 pts)? Answer:
Show DP-figure-1. Let W = 10 and i Vi w; 1 2 10 40 5 4 3 4 30 50 6 3 0 1 2 0 0 0 0 0 0 1 0 0 0 0 0 2 0 0 0 0 0 3 0 0 0 0 50 4 0 0 40 40 50 5 6 7 8 0 0 0 0 10 10 10 10 40 40 40 40 40 40 40 40 50 50 90 90 9 0 10 50 50 90 10 0 10 50 70 90
Expert Answer
Answer to This question is for dynamic programming algorithms – Java. Please explain clearly. Thank You! Here is the example menti…