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 to Expert-Tailored Solutions

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

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

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

Get Started

Recommended Textbook for

Building Database Driven Catalogs

Authors: Sherif Danish

1st Edition

0070153078, 978-0070153073

More Books

Students also viewed these Databases questions

Question

What is the density in grams per liter of nitrogen gas at STP?

Answered: 1 week ago