|
|
|
|
|
by amouat
6135 days ago
|
|
They seem to get finding the median slightly wrong: "Note that finding the median of an array is a special case of this where k = n/2." I'm pretty sure it should be k = (n+1) / 2. (If there are 5 numbers, you want the 3rd one, if there are 6 numbers you want the average of 3 and 4.) |
|
For arrays whose length is even, I think it's also acceptable to take either one of the two values (instead of the mean of the two) as the median value. Wikipedia is fairly ambiguous on this as it only states "one often takes the mean" and "sometimes one takes the average of the two median numbers".
I believe that for a large enough sample size the discrepancy shouldn't even matter all that much.