Learning objectives
After this class, you should be able to:
- Given a sequence of
n
integers, a numberk
in[1,n]
, and a sequence of random numbers, show the steps involved in applying the simple randomized selection algorithm discussed in class to find thek
th smallest of these numbers.- Analyze the time complexity of the randomized selection algorithm discussed in class.
Reading assignment
- Class notes and handout on randomized selection.
Exercises and review questions
- Questions on current lecture's material
- (Post your answer on the discussion board) Show how the randomized selection algorithm that we discussed in class would determine the
4
th smallest number of 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.- We showed that
T(n) ≤ 4n
. Instead, assume thatT(n) ≤ cn
, redo the derivation, and show that takingc = 4
will satisfy your assumption.- Questions on next lecture's material
- None.