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 Knapsack problem, we are given a set of items and the goal is to find a subset of that does not exceed the capacity and maximizes the total value of the items in Now consider the following generalization of the problem. As before, we have a knapsack with integer capacity and we have a set of items, each with weight and value but we have a limited number of copies call it c of such items available to usWe want to know how to optimally fill the knapsack.
a Formulate this variation of the 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 highlevel and lowlevel pseudocode. Hint: Think about the dynamic programming solution to the 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?
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
