Overview
Floyd-Rivest selection improves quickselect-style selection by using a sample to estimate a narrower interval around the desired rank. It then partitions only the range likely to contain the kth item.
Selects the kth order statistic by sampling to narrow the partition range.
Compact metadata for implementation and discovery.
Floyd-Rivest selection improves quickselect-style selection by using a sample to estimate a narrower interval around the desired rank. It then partitions only the range likely to contain the kth item.
Quick facts
Runtime and memory behavior at a glance.
Best
O(n)
Average
O(n)
Worst
O(n)
Space
O(1)
Show sampling to choose a pivot range before partitioning on a small order statistic selection example.
Floyd-Rivest is a selection algorithm; it does not produce a sorted array.
What each reference supports for this entry.
Original reference for SELECT and improved expected comparisons in order-statistic selection.
Open sourceGood next jumps from the relationship graph, ranked for useful discovery.
Floyd-Rivest uses sampling to reduce the expected partition range.
Median-of-medians gives deterministic worst-case bounds, while Floyd-Rivest is optimized for average behavior.