Need syntax for MEDIAN
Need syntax for MEDIAN
I need to calculate the Median in a C routine.
My pseudo code would look like (I think)... where cnt1[i] my array:
if cnt1[i] = even number then
[(cnt1[i]) + (cnt1[i] -1)] /2
else
cnt1[i] /2
end
I'm new to C and have no idea as to how the actual syntax should look like. Any ideas?
skydivetom
27 Sep 07, 9:09AM
Take a look at:
http://www.codecogs.com/d-ox/stats/moments/median.php
In essence you run through the data and find the n/2 th smallest number. Or largest!
Hope this helps. Will
Login