Why it matters

MoM enables worst-case linear selection. Understanding shapes selection theory.

Advertisement

The architecture

Group into 5s.

Median of each group.

Recursively find median of medians.

Use as pivot.

Median of mediansGroups of 5sort eachMediansone per groupRecursemedian of mediansGuarantees 30/70 split; complex constants; rarely faster in practice than randomized
MoM.
Advertisement

How it works end to end

Groups of 5 give 30/70 pivot guarantee.

T(n) = T(n/5) + T(7n/10) + O(n) = O(n).

Theoretical importance.