Why it matters

Selection is core primitive. Understanding shapes algorithm design.

Advertisement

The architecture

Quickselect: randomized partition.

MoM: deterministic worst O(n).

Introselect: hybrid.

Selection algorithm spectrumQuickselectexpected O(n)MoMworst O(n)Introselecthybrid + practicalstd::nth_element uses Introselect; practical + guaranteed worst-case
Selection deep.
Advertisement

How it works end to end

Introselect switches to MoM on bad pivots.

Quickselect fast in practice.

Median of medians linear worst-case.