Question: In the 0 - 1 Knapsack problem, we are given a set S of items and the goal is to find a subset T of

In the 0-1 Knapsack problem, we are given a set S of items and the goal is to find a subset T of S that does not exceed the capacity W and maximizes the total value of the items in T. Now consider the following generalization of the problem. As before, we have a knapsack with integer capacity W, and we have a set S of items, each with weight wi and value vi, but we have a limited number of copies (call it c) of such items available to us.We want to know how to optimally fill the knapsack.
a. Formulate this variation of the 0-1 Knapsack problem as a computational problem. That is, specify the input and output of the problem. (This is not as easy as it first seems. In particular, what should the output be?)
b. Design a dynamic programming solution (write pseudocode) to this problem. Your pseudocode can be a combination of high-level and low-level pseudocode. (Hint: Think about the dynamic programming solution to the 0-1 Knapsack problem. What possibilities do we now need to consider in this generalized version of the problem?)
c. What is the worst case running time of your algorithm?
 In the 0-1 Knapsack problem, we are given a set S

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 Databases Questions!