Averages/Median: Difference between revisions

Content added Content deleted
(→‎{{header|Go}}: add partial sort, quickselect examples)
m (Lingo added)
Line 1,877: Line 1,877:
Median of 4.4,2.3,-1.7,7.5,6.6,0.0,1.9,8.2,9.3,4.5 is 4.45
Median of 4.4,2.3,-1.7,7.5,6.6,0.0,1.9,8.2,9.3,4.5 is 4.45
</pre>
</pre>

=={{header|Lingo}}==
<lang Lingo>on median (numlist)
-- numlist = numlist.duplicate() -- if input list should not be altered
numlist.sort()
if numlist.count mod 2 then
return numlist[numlist.count/2+1]
else
return (numlist[numlist.count/2]+numlist[numlist.count/2+1])/2.0
end if
end</lang>


=={{header|LiveCode}}==
=={{header|LiveCode}}==