{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

hw_6_soln - CS 473 Algorithms Fall 2010 HW 6(due Tuesday...

This preview shows pages 1–3. Sign up to view the full content.

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 1-3 can be worked in groups of up to 3 students each. Problem 0 should be answered in Compass as part of the assessment HW6-Online and should be done individually. 0. (10 pts) HW6-Online 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 two-stage 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 sous-chefs to finish off. Assume that there are essentially an unlimited number of sous-chefs 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 sous-chef (the sous-chefs 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 non-increasing. 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 non-increasing 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 sous-chef starts working on them at the same time in both cases) therefore all of them finish no later than T . We will 1

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
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 D i +1 T.
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

Page1 / 5

hw_6_soln - CS 473 Algorithms Fall 2010 HW 6(due Tuesday...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online