Question: 3. Two bags Knapsack (25 points) Knapsack problem for In this question, you are required to solve the 0-1 two knapsacks. You are given a

3. Two bags Knapsack (25 points) Knapsack problem for In this question, you are required to solve the 0-1 two knapsacks. You are given a set of n objects. The weights of the objects are w1, w2,...,wn, and the values of the objects are vi, v2,... , Vn. You are given two knap- sacks each of weight capacity C. If an object is taken, it may placed in one knapsack or the other, but not both. All weights and values are positive integers Design an O(nC2) dynamic programming algorithm that deter- mines the maximum value of objects that can be placed into the two knapsacks. Your algorithm should also determine the contents of each knapsack. Justify the correctness and running time of your algorithm
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
