Randomized Quickselect and Progress Phases

Bound expected selection work by isolating random pivots that shrink the remaining problem by a constant fraction.

Source
Anbloq
Language
English
Created
Updated
Chapters
2
Reading time
1 min
In this article2 chapters
  1. Keep only the side containing the requested rank
  2. Charge work until the next good split

Keep only the side containing the requested rank

Pick a uniform key as pivot, partition three ways, and inspect the requested rank. If it lands in the equal bucket, return the pivot. Otherwise recurse into just one strict side with the adjusted rank. For distinct keys, a pivot in the middle half of ranks leaves at most three quarters of the keys on either side. Repeated values can only shorten the strict ranges compared with breaking ties consistently.

Charge work until the next good split

At every sufficiently large active size, a fresh pivot is good with probability bounded below by a constant. Before the next good split, failed choices do not increase the problem size, so expected total work in the phase is linear in the starting size. Each completed good phase shrinks that size by a constant factor. The resulting geometric sum is \(O(n)\) in expectation, although unlucky runs can be quadratic. Median-of-medians selection replaces the probabilistic shrink condition with a deterministic one.[1][2]

References

  1. MIT OpenCourseWare, Design and Analysis of Algorithms: Lecture Notes ↩
  2. Michael Mitzenmacher and Eli Upfal, Probability and Computing ↩