edited by
2,784 views
0 votes
0 votes
5.Consider the Knapsack instance with 5 objects and a capacity M=11, profit P=(5,4,7,2,3) and
weight W=(4,3,6,2,2.). Solve it using dynamic programming approach.
edited by

1 Answer

1 votes
1 votes

 

                                

0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 5 5 5 5 5 5 5 5
0 0 0 4 5 5 5 9 9 9 9 9
0 0 0 4 5 5 7 9 9 9 9 9
0 0 2 4 5 6 7 9 9 11 12 13
0 0 3 4 5 7 8 9 10 12 12 14

 

 

Columns w represents weights <0, 1, 2, 3, ........11>

Rows i represent Item number <0, 1, 2, 3, 4, 5>

cell <i, w> indicates total profit P by "including any/some/all of the first i items in knapsack having combined weight w"

verify it !!

Related questions

0 votes
0 votes
0 answers
1
karan25gupta asked Apr 17, 2019
691 views
In 0/1 knapsack problem ,suppose if maximum weight is given as W and we are asked to find out max profit then * IS IT NECESSARY THAT THE TOTAL WEIGHT SHOULD BE EXACTLY EQ...
2 votes
2 votes
1 answer
2
1 votes
1 votes
1 answer
3
LavTheRawkstar asked Mar 25, 2017
2,595 views
Number of Cateogires are 5, Thier total weights are w1,w2,w3,w4,w5={7,2,4,8,6}b1,b2,b3,b4,b5={5,6,4,3,2}M=6=Maximum Capacity= WI am having confusion How to solve using dy...
0 votes
0 votes
1 answer
4