Re: problem on medians




"Ajinkya" <kaleajinkya@xxxxxxxxx> wrote in message news:1180589789.498330.85780@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
What are the least no. of comparisons required to find the median of a
set of n integers ?
Which is the best algorithm for this?

PS: not a homework question!

If it is not homework then copy the numbers to a temporary array, sort them with qsort(), and take the middle.
There might be a cleverer way of doing it, but it is pointless in a practical app.
--
Free games and programming goodies.
http://www.personal.leeds.ac.uk/~bgy1mm


.