Think of the following set of numbers:
5 2 6 3 1
The median of these numbers is 3
. Now if you have a number n
, if n > 3
, then it is bigger than at least half of the numbers above. If n < 3
, then it is smaller than at least half of the numbers above.
So that is the idea. That is, for each set of 5 numbers, you get their median. Now you have n / 5
numbers. This is obvious.
Now if you get the median of those numbers (call it m
), it is bigger than half of them and smaller than the other half (by definition of median!). In other words, m
is bigger than n / 10
numbers (which themselves were medians of small 5 element groups) and bigger than another n / 10
numbers (which again were medians of small 5 element groups).
In the example above, we saw that if the median is k
and you have m > k
, then m
is also bigger than 2 other numbers (that were themselves smaller than k
). This means that for each of those smaller 5 element groups where m
was bigger than its median, m
is also bigger than two other numbers. This makes it at least 3 numbers (2 numbers + the median itself) in each of those n / 10
small 5 element groups, that are smaller than m
. Hence, m
is at least bigger than 3n/10
numbers.
Similar logic for the number of elements m
is bigger than.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…