Answered step by step
Verified Expert Solution
Question
1 Approved Answer
While walking through the Middle East, you come across the Cave of Forty Thieves. In this cave there are n treasures t 1 , t
While walking through the Middle East, you come across the Cave of Forty Thieves. In this cave there are n treasures t t tn which have weights w w wn and values v v vn Unfortunately, the only sack you carry can carry at most P units of weight before breaking, so you probably won't be able to take all the treasures. Fortunately, you also bring with you a magic knife that allows you to split any treasure that doesn't fit whole in your sack to take just a portion of it We assume that, when splitting a treasure, it maintains a consistent fraction in terms of its weight and value that is the third part of the treasure ti has weight wi and value vi a Describe a time theta n log n greedy algorithm to maximize the total value of the treasures added to the bag. b Prove that your algorithm is correct. c Show how to improve the time to On using the kselection algorithm.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started