Question: (C) Now consider the following algorithm for the knapsack problem. Call the relative value of item i the ratio vali/wti. Consider the greedy algorithm which,

 (C) Now consider the following algorithm for the knapsack problem. Call

(C) Now consider the following algorithm for the knapsack problem. Call the relative value of item i the ratio vali/wti. Consider the greedy algorithm which, among the remaining items, chooses the item of marimum relative value such that it will not make the total weight exceed the threshold W. Give an example of knapsack where this greedy algorithm fails. Show the order in which the algorithm selects the items, and also show a higher-value subset whose weight does not erceed the threshold. Same comments apply as on problem 2

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!