Fix median calculation formula

The median calculating formula seems to be broken.

For example the formula applied on array of [1,2,3,4] previously calculated 2 as the median. In usual cases, however, 2.5 would be the answer ( (2 + 3) / 2 ).

For odd length arrays the formula is obviously faulty. For [1,2,3,4,5] it would return 4, when 3 is the only correct answer.