Selection Problem

  • Selecting the th order statistic from numbers. There are algorithms asymptotically faster than sorting the array first.
  • Modeled after quicksort, but only works on one partition, which is an example of prune-and-search technique, thus the runtime is instead of .
  • Random Selection has a worst case runtime of , in the case of finding minimum, as the size of problem is reduced only by at each partitioning.
  • Randomized Selection, improved
    • Dividing into 5-elements groups
    • Sort each groups
    • Recursively find the “median of medians”
    • Use the”median of the medians” as our pivot, so that we are guaranteed to eliminate 3/7 of the elements no matter how we partition.
  • Median of two sorted arrays: Find two medians, compare, discard the upper/lower halves accordingly, recurse.
  • multi-selection problem
    • Find the middle one of the .
    • Use selection to find the th element.
    • Use this element as pivot to partition, so that each partition has half of the s.