3 ms·
The textbook solution is to use this pivot selection algorithm: https://en.wikipedia.org/wiki/Median_of_medians https://en.wikipedia.org/wiki/Median_of_medians
by betterunix2 8y ago
The textbook solution is to use this pivot selection algorithm:
https://en.wikipedia.org/wiki/Median_of_medians https://en.wikipedia.org/wiki/Median_of_medians
In practice it is not really worth it.
- jchanimal 8y agoNo matter how clever you are with an algorithm, somebody wrote a paper on it in the 70s.