problem on medians

Discussion in 'C Programming' started by Ajinkya, May 31, 2007.

  1. Ajinkya

    Ajinkya Guest

    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
    Ajinkya, May 31, 2007
    #1
    1. Advertising

  2. Ajinkya

    Ian Collins Guest

    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.
    Ian Collins, May 31, 2007
    #2
    1. Advertising

  3. Ajinkya

    Ajinkya Guest

    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.
    Ajinkya, May 31, 2007
    #3
  4. "Ajinkya" <> wrote in message
    news:...
    > 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
    Malcolm McLean, May 31, 2007
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Andreas Suurkuusk
    Replies:
    0
    Views:
    3,968
    Andreas Suurkuusk
    Jul 27, 2003
  2. Replies:
    3
    Views:
    315
  3. Ajinkya

    problem on medians

    Ajinkya, May 31, 2007, in forum: C Programming
    Replies:
    1
    Views:
    296
    osmium
    May 31, 2007
  4. Steve Howell

    medians for degree measurements

    Steve Howell, Jan 23, 2010, in forum: Python
    Replies:
    15
    Views:
    561
    Steve Howell
    Jan 25, 2010
  5. Mike

    Problem problem problem :( Need Help

    Mike, May 7, 2004, in forum: ASP General
    Replies:
    2
    Views:
    543
    Bullschmidt
    May 11, 2004
Loading...

Share This Page