




Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!





Jared Saia University of New Mexico
“Greed is Good” - Michael Douglas in Wall Street
Imagine you are given the following set of start and stop times for activities
(note: code for this algorithm is in section 16.1)
The problem:
(This is called the 0-1 knapsack problem because each item is either taken or not taken, the thief can not take a fractional amount)
≥ (xi − x′ i) vk wk
∑^ n i=
xivi −
∑^ n i=
x′ ivi (1)
∑^ n i=
(xi − x′ i) ∗ vi (2)
∑^ n i=
(xi − x′ i) ∗ wi
( vi wi
) (3)
∑^ n i=
(xi − x′ i) ∗ wi
( vk wk
) (4)
( vk wk
) ∗
∑^ n i=
(xi − x′ i) ∗ wi (5)
≥ 0 (6)
(xi − x′ i) ∗ wi =
∑^ n i=
xiwi −
∑^ n i=
x′ iwi (7)
= W − W ′^ (8) ≥ 0. (9)
Consider the inequality:
(xi − x′ i) vi wi
≥ (xi − x′ i) vk wk