Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

2. While walking on a beach, one day you found a treasure trove. The trove contains n treasures with weights w 1 , . .

2. While walking on a beach, one day you found a treasure trove. The trove contains n treasures with weights w1, . . . , wn and values v1, . . . , vn. Unfortunately you have a knapsack that only holds a total weight M. Fortunately there is a knife handy so that you can cut treasures if necessary; a cut treasures retains its frictional value (so, for example, a third of treasure i has weight wi / 3 and value vi / 3).

- Describe a (n log n) time greedy algorithm to solve this problem.

- Prove that your algorithm works correctly.

- Improve the running time of your algorithm to (n).

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

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

Recommended Textbook for

What Is A Database And How Do I Use It

Authors: Matt Anniss

1st Edition

1622750799, 978-1622750795

More Books

Students also viewed these Databases questions