There are $25$ horses with different speeds. My goal is to rank all of them, by using only runs with $5$ horses, and taking partial rankings. How many runs do I need, at minimum, to complete my task?
As a partial answer, I know that is possible to determine the first $3$ horses with $7$ runs, and, by a slight generalization of the optimal algorithm used to find the first three, have the complete ranking in $20$ runs.
Is it possible to do better?
What if we have $n$ horses and want to rank them with runs with $k$ horses?
quicksort
is I think the best one and runs in $n\log_2n$. – Tom-Tom May 07 '15 at 09:35quicksort
is not necessarily the best regarding the absolute count of (best/average/worst case) comparison operations. But as there are $n!$ possible orders and each comparison gives us at most one bit of info, we certainly need at least $\log_2 n!\approx\log_2( n^ne^{-n}\sqrt{2\pi n})\sim n\log_2 n$ – Hagen von Eitzen Sep 25 '19 at 22:13