2 # $NetBSD: median.awk,v 1.1.1.3 1997/10/03 22:25:29 christos Exp $
4 # print out the median time to each hop along a route.
6 for (f =
5; f
<=
NF; ++f
) {
13 # insertion sort the times to find the median
14 for (i =
2; i
<= n
; ++i
) {
15 v = time
[i
]; j = i
- 1;
24 if (n
> 1 && (n %
2) ==
0)
25 median =
(time
[n
/2] + time
[(n
/2) + 1]) / 2
27 median = time
[(n
+1)/2]