https://www.cs.dartmouth.edu/~doug/aqsort.c and https://github.com/matslina/qsort/blob/master/antiqsort.c ...
https://en.wikipedia.org/wiki/Median_of_medians
In practice it is not really worth it.