Paul McGuire wrote: > <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > > [snip] > > > > no sort() is needed to calculate the median of a list. > > > > you just need one temp var. > > > > Ok, I'll bite. How do you compute the median of a list using just a single > temp var? > > -- Paul
hi Paul; well when this was a stats-class assignment (back when pascal was popular :) i just stepped through the vector and compared it (pseudo-code) ptr p = [with values]. fun median { var x = 0. while( *p++) { if( (*p) > x) x = *p. } return x. } of course, pascal is more verbose but that's median() -- http://mail.python.org/mailman/listinfo/python-list