Question: Knapsack Problems [ 3 0 Points ] Recall that in a knapsack problem, given n items of known weights w 1 , . . .

Knapsack Problems [30 Points] Recall that in a knapsack problem, given n items of known
weights w1,..., wn and values v1,..., vn and a knapsack of capacity W , we want to find the most valuable
subset of the items that fit into the knapsack. In the 2-D (or 2-dimensional) version of the knapsack
problem, each item i has weights wi1 and wi2 for two dimensions, and the capacity is now W1 and W2.
We want to find the most valuable subset of the items that fit into the knapsack (i.e., do not exceed the
capacity of each dimension).
3.1[15 Points] Design a dynamic programming algorithm for the problem (based on the dynamic
programming discussed in classes). What are the time and space complexities of the algorithm?
3.2[15 Points] Suppose we only care about not exceeding the capacity of any one dimension (e.g., the
final subset might exceed one dimension but not both) for the 2-D version of the knapsack problem.
Design a dynamic programming algorithm for this variant. What are the time and space complexities
of the algorithm?
3.3[20 Points (Honors)] Answer Parts 3.1 and 3.2 for the k-D (or k-dimensional) version of the
knapsack problem, each item i has k weights wi1,..., wik for two dimensions, and the knapsack capacity
is now W1,..., Wk for any k 1.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!