If you can break items (which means you can take a part of an item, not 0-1 knapsack), which algorithm is the best choice? How do you use it to solve this problem? (in word or pseudo code)
Given weights and values of n items, put these items in a knapsack of capacity W to get the maximum total value in the knapsack. Also given an integer W which represents knapsack capacity, find out the maximum value subset of yal[] such that the sum of the weights of this subset is smaller than or equal to W. You cannot break an item, either pick the complete item or don't pick it (0-1 property).
0-1 Knapsack Problem
value = {60, 100, 120}; weight = {10, 20, 30}; W = 50;
Weight = 10; Value = 60;
Weight = 20; Value = 100;
Weight = 30; Value = 120;
Weight = (20+10); Value = (100+60);
Weight = (30+10); Value = (120+60);
Weight = (30+20); Value = (120+100);
Solution: 220
Weight = (30+20+10) > 50