Answered step by step
Verified Expert Solution
Question
1 Approved Answer
( 1 0 points ) Mr E next shows you his Bag of Limited Holding. It can only hold so much, ( b ) After
points Mr E next shows you his Bag of Limited Holding. It can only hold so much, b After a heated argument, he accepts that your example proves his algorithm is not correct. He now makes you consider the following algorithm for the knapsack problem. Call the relative value of item i the ratio Consider the greedy algorithm which, among the remaining items, chooses the item of maximum rel ative value such that it will not make the total weight exceed the threshold Give an example of knapsack where this greedy algorithm fails. Show the order in which the algorithm selects the items, and also show a highervalue subset whose weight does not exceed the threshold. so he's trying to maximize the value of the items with which he'll fill his Bag. a MrE hands you a list of items, each with a value and weight and a threshold weight All values and weights are strictly positive. He is trying to select a subset of the items such that and maximizing Note that, unlike changemaking, here there is only one of each item, whereas in changemaking you in principle have an unlimited number of each type of coin. He "patiently" describes the following greedy algorithm: among the remaining items, choose the item of maximum value such that it will not make the total weight exceed the threshold Give an example of knapsack with at least items where this greedy algorithm fails. Show the order in which the algorithm selects the items, and also show a highervalue subset whose weight does not exceed the threshold.
points Mr E next shows you his Bag of Limited Holding. It can only hold so much, b After a heated argument, he accepts that your example proves his algorithm is
not correct. He now makes you consider the following algorithm for the knapsack
problem. Call the relative value of item i the ratio Consider the greedy
algorithm which, among the remaining items, chooses the item of maximum rel
ative value such that it will not make the total weight exceed the threshold
Give an example of knapsack where this greedy algorithm fails. Show the order in
which the algorithm selects the items, and also show a highervalue subset whose
weight does not exceed the threshold.
so he's trying to maximize the value of the items with which he'll fill his Bag.
a MrE hands you a list of items, each with a value and weight and a
threshold weight All values and weights are strictly positive. He is trying to
select a subset of the items such that and maximizing
Note that, unlike changemaking, here there is only one of each item, whereas in
changemaking you in principle have an unlimited number of each type of coin.
He "patiently" describes the following greedy algorithm: among the remaining
items, choose the item of maximum value such that it will not make the total
weight exceed the threshold
Give an example of knapsack with at least items where this greedy algorithm
fails. Show the order in which the algorithm selects the items, and also show a
highervalue subset whose weight does not exceed the threshold.
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