{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

hw3 - Fall 11 CSci 5421Advanced Algorithms and Data...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
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/1-knapsack 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 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 in O ( n ) time. Describe the main ideas, give pseudocode, and analyse the running time.
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

Ask a homework question - tutors are online