Median of medians
infogalactic Median of medians
In computer science, the median of medians algorithm is a selection algorithm based on the quickselect algorithm, and is optimal, having worst-case linear time complexity for selecting the *k*th largest element.