Now compute the median and the standard deviation of the numbers given in the earlier example.
Median:
if there are odd number of values then - after sorting them - pick the one in the middle.
if there are even number of values, took the 2 in the middle and compute their average
Standard deviation:
sum (for each i) (Xi-average) * (Xi-average)
divide by n (the number of elements)
take the square root of the result
| Prev | Home (Copyright Gabor Szabo) Perl Training Israel | Next |
| Diamond operator | Up | Exercise: sort mixed string |