Median: In probability theory and statistics, a median is described as the number separating the higher half of a sample, a population, or a probability distribution, from the lower half.
The median of a finite list of numbers can be found by arranging all the numbers from lowest value to highest value and picking the middle one.
For odd n, Median (M) = value of ((_n_ + 1)/2)th item term
.
For even n, Median (M) = value of {(_n_/2)th item term + (_n_/2 + 1)th item term}/2
- For example, for
arr = [2,3,4]
, the median is3
. - For example, for
arr = [2,3]
, the median is(2 + 3) / 2 = 2.5
.