Fall 11: CSci 5421—Advanced Algorithms and Data StructuresOut 10/12Homework 3Due 10/31Please do all problems; we will grade a subset of three to four problems. Any Exercise/Problemnumbers refer to the 3rd editionof the text. (Corresponding numbers for the second edition aregiven, where available, in parentheses.) Please follow all of the instructions given in the handoutfor Homework 1.1.(12 points) Suppose that in the 0/1-knapsack problem, the order of the items if sorted byincreasing weight (i.e.,wi’s) is the same as when they are sorted by decreasing value (i.e.,vi’s).Assume that you are given an unsorted set of items. Describe, in words, anO(nlogn)-time greedyalgorithm to compute a subset of items of maximum value whose total weight is at most theknapsack capacity (i.e.,W).Use the two-step proof method and establish the greedy choice property and optimal substructure.A clear, well-articulated proof is expected.2.(12 points) Give an algorithm to solve the problem in Question 1 inO(n) time. Describe themain ideas, give pseudocode, and analyse the running time.
This is the end of the preview.
access the rest of the document.