3 ms·
Well, you do get an (expected time) asymptotically efficient algorithm for sorting the first k elements of an array by running quicksort without recursing on th
by fmap 10y ago
Well, you do get an (expected time) asymptotically efficient algorithm for sorting the first k elements of an array by running quicksort without recursing on the last n-k elements. This is what you get in Haskell with "take k (sort xs)".
But, as you mentioned the constant factors involved are ridiculously high and this is not going to give you a practical solution.