Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > problem on medians

Reply
Thread Tools

problem on medians

 
 
Ajinkya
Guest
Posts: n/a
 
      05-31-2007
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

 
Reply With Quote
 
 
 
 
Ian Collins
Guest
Posts: n/a
 
      05-31-2007
Ajinkya wrote:
> 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.

--
Ian Collins.
 
Reply With Quote
 
 
 
 
Ajinkya
Guest
Posts: n/a
 
      05-31-2007

Ian Collins wrote:
> Ajinkya wrote:
> > 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!

sorry!
>
> Try somewhere like comp.programming.

Ok. thanks.
>
> --
> Ian Collins.


 
Reply With Quote
 
Malcolm McLean
Guest
Posts: n/a
 
      05-31-2007

"Ajinkya" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) ups.com...
> 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


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
medians for degree measurements Steve Howell Python 15 01-25-2010 06:36 PM
problem on medians Ajinkya C Programming 1 05-31-2007 01:04 PM
Help with array medians, modes, and searching inkexit@yahoo.com C++ 3 11-29-2005 10:10 AM
Problem problem problem :( Need Help Mike ASP General 2 05-11-2004 08:36 AM



Advertisments