Fall 11: CSci 5421—Advanced Algorithms and Data Structures
Out 10/12
Homework 3
Due 10/31
Please do all problems; we will grade a subset of three to four problems. Any Exercise/Problem
numbers refer to the 3rd edition
of the text. (Corresponding numbers for the second edition are
given, where available, in parentheses.) Please follow all of the instructions given in the handout
for Homework 1.
1.
(12 points) Suppose that in the 0/1knapsack problem, the order of the items if sorted by
increasing weight (i.e.,
w
i
’s) is the same as when they are sorted by decreasing value (i.e.,
v
i
’s).
Assume that you are given an unsorted set of items. Describe, in words, an
O
(
n
log
n
)time greedy
algorithm to compute a subset of items of maximum value whose total weight is at most the
knapsack capacity (i.e.,
W
).
Use the twostep proof method and establish the greedy choice property and optimal substructure.
A clear, wellarticulated proof is expected.
2.
(12 points) Give an algorithm to solve the problem in Question 1 in
O
(
n
) time. Describe the
main ideas, give pseudocode, and analyse the running time.
This is the end of the preview.
Sign up
to
access the rest of the document.
 Fall '08
 Sturtivant,C
 Algorithms, Data Structures, Greedy algorithm, Optimal substructure, wellarticulated proof

Click to edit the document details