Answered step by step
Verified Expert Solution
Link Copied!

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 n items and knapsack that can hold a maximum weight of W.
Item i has value vi and weight wi. The goal is select a subset of items with maximum total
value subject to the constraint that their total weight is at most W.
There are dynamic programing algorithms for knapsack that run in O(nW) and O(nV)
time, where V=i?vi. These algorithms are pseduo-polynomial because the inputs to the
problem can be expressed in logW space. Therefore, O(nW) is actually exponential in the
input size! In fact, we can show the knapsack problem is NP-hard (for example from the
partition problem).
For any subset of items S, it will be convenient to define V(S)=iinS?vi, as the value
of S, and W(S)=tinS?wi, as the weight.
Problem 1
A natural greedy strategy is to rank the items by 'how good they are' (as measured by the
ratio of value to weight viwi) and pick items in decreasing order until the knapsack is filled.
Greedy
Sort and relabel items so that v1w1v2w2cdotsvnwn.
Take the largest subset {1dotsk} that fits in the knapsack, t=1kwkW.
ModifiedGreedy
Return max(output of Greedy, highest valued item)
a) Provide an example input where Greedy ~~OP?W. You don't need to assume that
vi's and wi's are integers.
b) Suppose that Greedy takes the first k items {1,dots,k}. Prove that
i=1k+1vi>OPT,
note that this bound takes one additional item vk+1.
image text in transcribed

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

The Database Factory Active Database For Enterprise Computing

Authors: Schur, Stephen

1st Edition

0471558443, 9780471558446

More Books

Students also viewed these Databases questions