Question: The classical 0 , 1 knapsack problem is the following. We are given a set of n items. Item i has two positive integers associated

The classical 0,1 knapsack problem is the following. We are given a set of n items. Item i has two positive integers associated with it: a size s_i and a profit p_i. We are also given a knapsack of integer capacity B. The goal is to find a maximum profit subset of items that can fit into the knapsack. (A set of items fits into the knapsack if their total size is less than the capacity B.) Use dynamic programming to obtain an exact algorithm for this problem that runs in O(nB) time. Also obtain an algorithm with running time O(nP) where P=_(i=1)^np_i . Note that both these algorithms are not polynomial time algorithms. Do you see why?

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!