3.1 Solve the sparse matrix problems described in class.
3.2 CLR Problem 1-2 (pg 17-18).
3.3 CLR Problem 1-3 (pg 18).
3.4 Low values of the insertion index are very common in practical
applications. Why? Argue that insertion sort and bubblesort take
O(kn) time on lists with insertion index k. Show that both can
actually run even faster: for insertion index k=n/2 for
some lists.
Say why mergesort can take even for k=1. What
simple change can we make to mergesort to help? Analyze the effect of
this improvement for k=1. Can you extend your argument to arbitrary
k to get a bound for mergesort?
3.5 CLR Exercise 8.4-4 (pg. 167).
3.6 In most randomized models of computation, there is a primitive
operation RANDBIT that returns 0 with probability 1/2 and 1
with probability 1/2. Taking RANDBIT to be a unit-time
primitive, design an algorithm RANDTRIT that returns 0 with
probability 1/3, 1 with probability 1/3, and 2 with probability
1/3. Compute a bound on the expected number of calls to RANDBIT that your algorithm makes. What about worst-case? Do you
think it is possible to define a RANDTRIT algorithm with small
worst-case time?