{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

9104302 - CS 473(ug Combinatorial Algorithms Fall 2005...

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

CS 473 (ug): Combinatorial Algorithms, Fall 2005 Homework 1 Solutions This homework was due on Sep 9, with an automatic extension to Sep 12.

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

View Full Document
CS 473 (ug) Homework 1 Solutions Fall 2005 1. Problem 4.12: a) The statement is false. As a counterexample, consider the streams ( b 1 , t 1 ) = (1000 , 1) and ( b 2 , t 2 ) = (100 , 100) with r = 500. The streams can be scheduled (do stream 2 first), but b 1 > rt 1 . b) Notice that the question does not ask for an algorithm that produces a schedule if one exists; you only need an algorithm that outputs whether a schedule exists or not. A simple linear-time solution is to calculate B = n i =1 b i and T = n i =1 t i . If B > rT , no schedule exists. (This follows because after all streams have been scheduled, the total bandwidth used will be B and the time elapsed will be T , and since B > rT , the constraint is violated.) If B rT , we claim that a valid schedule exists. Proof: Consider the schedule in which streams are sorted in increasing order of b/t . After stream i has completed, the total number of bits sent so far is i j =1 b j (call this B i ), and the total time elapsed is i j =1 t j (call this T i ). We can see that B 1 T 1 B 2 T 2 . . . B n T n = B T r , because B i T i is simply the average bit-rate of the first i streams, and since the streams are sorted in increasing order of bit-rates, the average of the first i + 1 streams must be greater than that of the first i streams. But the average after all the streams is r , and so for all i , B i T i r . We show that B i +1 T i +1 B i T i more formally below: B i +1 T i +1 = B i + b i +1 T i + t i +1 B i + t i +1 B i T i T i + t i +1 Because b i +1 t i +1 B i T i = B i T i + t i +1 T i T i + t i +1 = B i T i We have shown that if B rT (we do not violate the constraint at the end), then there is a schedule such that the constraint is not violated after each stream is completed. What about the time while a stream is being sent? If the average bit-rate is r at the beginning and end of the stream, then can it exceed r in the middle of the stream? It’s easy to show that it cannot; here’s an interesting idea that can be converted into a proof with very little effort. Suppose stream i runs from t 1 to t 2 , and at both times t 1 and t 2 , the average bit-rate is r . To show that the bit-rate is r at any time t , t 1 < t < t 2 , simply break stream i into two streams, one called i 1 of length t - t 1 and the other, i 2 , of length t 2 - t . Now we have a new schedule with 1 extra stream; by the argument above we know that the average bit-rate is r after the end of every stream. In particular, at time t , after stream i 1 has been sent, the average bit-rate is r . Another solution to this problem is to sort the streams in increasing order of b/t , and show that if any schedule does not violate the constraint, then this one does not. The argument is essentially similar to the one above; the main difference is that the first method just gives a 1
CS 473 (ug) Homework 1 Solutions Fall 2005 condition for a schedule to exist, while the second method actually outputs a feasible sched- ule.

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

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}