Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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 cdots
Take the largest subset dotsk that fits in the knapsack,
ModifiedGreedy
Return maxoutput of Greedy, highest valued item
a Provide an example input where Greedy ~~ You don't need to assume that
s and s are integers.
b Suppose that Greedy takes the first items dots, Prove that
OPT,
note that this bound takes one additional item
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