The python algo does not get slow when n is large. The k~n case obviously calls for inverse selection.
https://github.com/python/cpython/blob/master/Lib/random.py#...
https://github.com/python/cpython/blob/master/Lib/random.py#...
Yeah, but the k ~ n/2 case (in which inverse selection and normal selection have the same runtime) is still Ω(n log n) (equiv Ω(k log k)), which is still "slower" than the presented algorithm.