problem on medians

A

Ajinkya

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!

Ajinkya
 
I

Ian Collins

Ajinkya said:
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!
Nor is it a C one!

Try somewhere like comp.programming.
 
M

Malcolm McLean

Ajinkya said:
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top