This preview shows pages 1–3. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: CS 473: Algorithms, Fall 2010 HW 6 (due Tuesday, October 19) This homework contains four problems. Read the instructions for submitting homework on the course webpage . In particular, make sure that you write the solutions for the problems on separate sheets of paper; the sheets for each problem should be stapled together. Write your name and netid on each sheet. Collaboration Policy: For this home work, Problems 13 can be worked in groups of up to 3 students each. Problem 0 should be answered in Compass as part of the assessment HW6Online and should be done individually. 0. (10 pts) HW6Online on Compass. 1. (25 pts) A party of n people have come to dine at a fancy restaurant and each person has ordered a different item from the menu. Let D 1 ,D 2 ,...,D n be the items ordered by the diners. Since this is a fancy place, each item is prepared in a twostage process. First, the head chef (there is only one head chef) spends a few minutes on each item to take care of the essential aspects and then hands it over to one of the many souschefs to finish off. Assume that there are essentially an unlimited number of souschefs who can work in parallel on the items once the head chef is done. Each item D i takes h i units of time for the head chef followed by s i units of time for the souschef (the souschefs are all identical). The diners want all their items to be served at the same time which means that the last item to be finished defines the time when they can be served. The goal of the restaurant is to serve the diners as early as possible. Give an efficient algorithm to decide the order in which the head chef should prepare the items so as to minimize the time to serve the diners. Solution : Lemma: There is some optimal solution in which s i values are nonincreasing. Proof: Consider some optimal ordering, without loss of generalization we may assume D 1 ,...,D n is such an ordering, and let T be the latest complemetion time of a dish in this ordering (note that optimality of the ordering implies that T is minimum possible). If the s i values are not nonincreasing in this sequence, we should have index i such that s i < s i +1 . Now we switch D i and D i +1 in the ordering to obtain the new ordering D 1 ,...,D i 1 ,D i +1 ,D i ,D i +2 ,...,D n . Note that the completion time of all the dishes ex cept D i and D i +1 is the same in both orderings (because the souschef starts working on them at the same time in both cases) therefore all of them finish no later than T . We will 1 show that D i and D i +1 also finish no later than T : new completion time of D i = h 1 + + h i 1 + h i +1 + h i + s i new completion time of D i +1 = h 1 + + h i 1 + h i +1 + s i +1 original completion time of D i +1 = h 1 + + h i 1 + h i + h i +1 + s i +1 Since s i < s i +1 we have: new completion time of D i original completion time of D i +1 T new completion time of D i +1 original completion time of...
View
Full
Document
This note was uploaded on 04/18/2011 for the course CS 473 taught by Professor Chekuri,c during the Spring '08 term at University of Illinois, Urbana Champaign.
 Spring '08
 Chekuri,C
 Algorithms

Click to edit the document details