medianofmedians
Median of medians is a deterministic selection algorithm used to find the k-th smallest element in an unsorted list with guaranteed worst-case linear time. It is the pivot selection strategy employed by the BFPRT algorithm, named after Blum, Floyd, Pratt, Rivest, and Tarjan, who introduced it in 1973.
How it works: the input is divided into groups of five elements. Each group is sorted (or
Complexity and properties: the median-of-medians pivot ensures that a substantial fraction of elements is discarded in
Variants and history: using groups of five is standard and balances simplicity with the linear-time bound; other