The Median like the mean is another form of central tendency. It is the middle point of a sorted data set.
To calculate median, we must order our data set in ascending or descending order. If the data set is sorted from smallest value to biggest value, the exact middle value of the set is the Median.
Consider the below data set of 5 values.
Array = [12, 34, 56, 89, 32]
Now let us sort the data set.
Sorted array = [12, 32, 34, 56, 89]
The value at 3rd position is the middle point of the sorted list. So, 34 is our median for the array.
Median
In the previous example we had a data set with an odd number of records. So, we could easily find out the middle point. But what if the data set has an even number of records? For these situations, there will be two middle points. Thus, we need to calculate the average of the two to get the median. The below example illustrates how to calculate median from an even number of records.
Median for even number of records