Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

(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,

image text in transcribed

(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

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions