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 knapsack problem is the following. We are given a set of n items. Item i has two positive integers associated with it: a size si and a profit pi 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 OnB time. Also obtain an algorithm with running time OnP where Pinpi 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
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
