Problem 3 Consider the following version of Knapsack. Given are two weight limits W1 and W2, where Wi < W2. Given are al
-
answerhappygod
- Site Admin
- Posts: 899604
- Joined: Mon Aug 02, 2021 8:13 am
Problem 3 Consider the following version of Knapsack. Given are two weight limits W1 and W2, where Wi < W2. Given are al
Problem 3 Consider the following version of Knapsack. Given are two weight limits W1 and W2, where Wi < W2. Given are also n items (W1, C1), (W2, C2), ..., (Wn, Cn), where w; is the weight and Cị the cost of the i-th item. We want to find a subset of these items of the highest cost, with the restriction that the total weight of the chosen items must be at least W1 and at most W2. Give an O(nW2) algorithm for this problem. (Recall that the cost (respectively weight) of a subset is the sum of the costs (respectively weights) of the items in the subset.)
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!