Question: 3. Given n items {1,.., n), and each item i has a nonnegative weight wi and a distinct value v. We can carry a maximum

3. Given n items {1,.., n), and each item i has a nonnegative weight wi and a distinct value v. We can carry a maximum weight of W in a knapsack. The items are blocks of cheeses so that for each item i, we can take only a fraction xi of it, where 0 x, 1 . Then item i contributes weight X,Wi and value x v in the knapsack. The continuous knapsack problem asks you to take a fraction of each item to maximize the total value, subject to the total weight does not exceed W. The original knapsack problem is equivalent to say xi is either 0 or 1 depends whether the item is in or not. Give an O(n) algorithm for the continuous knapsack
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
