Question: Knapsack Problem This assignment develops a two approximation algorithms for the Knapsack problem, defined as follows. There is a set of n items and knapsack
Knapsack Problem
This assignment develops a two approximation algorithms for the Knapsack problem, defined
as follows. There is a set of items and knapsack that can hold a maximum weight of
Item i has value and weight The goal is select a subset of items with maximum total
value subject to the constraint that their total weight is at most
There are dynamic programing algorithms for knapsack that run in and
time, where These algorithms are pseduopolynomial because the inputs to the
problem can be expressed in space. Therefore, is actually exponential in the
input size! In fact, we can show the knapsack problem is NPhard for example from the
partition problem
For any subset of items it will be convenient to define as the value
of and as the weight.
Problem
A natural greedy strategy is to rank the items by 'how good they are' as measured by the
ratio of value to weight and pick items in decreasing order until the knapsack is filled.
Greedy
Sort and relabel items so that
Take the largest subset that fits in the knapsack,
ModifiedGreedy
Return maxoutput of Greedy, highest valued item
a Provide an example input where Greedy approximately close to TW You don't need to assume that
s and s are integers.
b Suppose that Greedy takes the first items Prove that
OPT,
note that this bound takes one additional item
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
