Learning objectives
After this class, you should be able to:
- Analyze the time complexity of the randomized quicksort algorithm.
- Given a sequence of data to be sorted, and a sequence of random numbers, show the steps involved in applying the randomized quicksort algorithm to sort this input.
Reading assignment
- Handout on randomized quicksort.
Exercises and review questions
- Questions on current lecture's material
- Show how the randomized quicksort algorithm that we discussed in class would sort the following sequence: 1 4 3 2 6 0 7 5. Use a sequence of random numbers generated by any of the Unix random number generators, and show this sequence too. Show the binary tree structure corresponding to the pivots chosen for the time complexity analysis, and the resulting level-order permutation, too.
- Questions on next lecture's material
- Show how randomized quicksort can be modified for finding the median of a sequence, by considering, at each step, only one of the partitions produced.
Last modified: 20 May 2004