

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


CMSC 451: Homework 2, Spring 2004
Due at the beginning of class on February 24.
Warning: some of the problems require thought - do not wait until the last day to start working on them! If you cannot come up with algorithms that run in the required time, then provide (correct) slower algorithms for partial credit. Write your answers using pseudo-code in the same style as the textbook. These make the algorithm description precise, and easy to read (as opposed to code in C or some other language).
∑n i=1 ci. For example, suppose^ n^ = 2,^ p^1 = 3, and p 2 = 5. If we schedule a 1 first and a 2 next, then c 1 = 3 and c 2 = 8. Otherwise, if we schedule a 2 first and a 1 next, then c 1 = 8 and c 2 = 5. Since 3 + 8 < 8 + 5, the first schedule is the optimal schedule in this example. (a) Suggest an algorithm to minimize the total completion time. Each task must run non-preemptively: i.e., once task ai is started, it must run continuously for pi units of time. (Hint: Consider small exam- ples with n = 2, n = 3 etc., to get a hint about how an optimal schedule will look.)
(b) Prove that your algorithm indeed minimizes the total completion time.
(a) Prove that the final set of edges that is output, is indeed a spanning tree. (b) Is the output indeed an MST? Justify your answer.