Question: 5. For the 0-1 Knapsack Problem, the item #1 has weight of 4 and the value of $12; the item #2 has weight of
5. For the 0-1 Knapsack Problem, the item #1 has weight of 4 and the value of $12; the item #2 has weight of 1 and the value of $1; the item #3 has weight of 5 and the value of $10; and the item #4 has weight of 2 and the value of $8. The capacity of the knapsack's weight is 10. The Dynamic Programming algorithm has produced the following array. Fill the last two entries in the array and show how they are calcurated. 0 1 2 3 4 0 0 0 0 0 0 1 0 0 1 1 1 2 3 4 0 0 0 0 0 1 1 8 1 1 9 12 12 12 22 12 5 0 12 13 22 6 7 0 0 12 13 33 13 13 13 20 8 9 0 0 10 0 12 12 13 13 13 22 23 12 12 13 13 13 21 21 a) (6 pts) D[4][9] = b) (6 pts) D[4][10] = c) (8 pts) Which items should be put in the knapscak to achieve the maximum profit? Show how you determined this result.
Step by Step Solution
3.42 Rating (146 Votes )
There are 3 Steps involved in it
1main code A dynamic programming based solution for 01 Knapsack problem inclu... View full answer
Get step-by-step solutions from verified subject matter experts
