(Latest Revision:
May 02, 2020)
Solution to Knapsack Problem
The table of values is:
Total Weight ----->
# wt val | 0 1 2 3 4 5 6 7 8 9 10
_________________________________________________________
0 0 0 | 0 0* 0 0 0 0 0 0 0 0 0
1 4 5 | 0 0 0 0 5 5* 5 5 5 5 5
2 3 4 | 0 0 0 4 5 5* 5 9 9 9 9
3 5 7 | 0 0 0 4 5 7 7 9 11 12 12*
4 3 2 | 0 0 0 4 5 7 7 9 11 12 12*
The results of the backtracking to figure out which objects are used is:
Packing Sack with weight limit of........ 10
------------------------------------
Object # Weight Value
3 5 7
1 4 5
------------------------------------
Totals 9 12