At Thursday 12/10/2006 17:44, [EMAIL PROTECTED] wrote:

> > > fun median {
> > >  var x = 0.
> > >   while( *p++) {
> > >     if( (*p) > x) x = *p.
> > >   }
> > >   return x.
> > > }

clearly, i've forgotten the definition of the median of a list.
to that i plead faulty memory.

That explains all. Finding the median in an efficient way (that is, without sorting the data first) isn't trivial, so your claim of "I can do that using only one temp variable" was a bit surprising... BTW, the median is the value which sits just in the middle of the list when ordered: median(3,5,12,1,2)=median(1,2,3,5,12) = 3


--
Gabriel Genellina
Softlab SRL

        
        
                
__________________________________________________
Preguntá. Respondé. Descubrí.
Todo lo que querías saber, y lo que ni imaginabas,
está en Yahoo! Respuestas (Beta).
¡Probalo ya! http://www.yahoo.com.ar/respuestas

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to