What is a median value?
The median of an array of numbers is the value of the middle item in the array, assuming the array is sorted. If the array has an even number of items, the median represents the average of the two middle values in the array.
This value is very popular one tries to understand “in which half my value is?”. For example, I got a D (or 80) in my last test at school, am I in the top 50% of my class students or not?
As a practical example, let’s look into the process of retrieving the median value from the following array of school test grades: [55, 80, 95, 100, 99, 70, 60].
- First, we’ll sort the array: [55, 80, 95, 100, 99, 70, 60] ===> [55, 60, 70, 80, 95, 99, 100].
- The array contains 7 items, which isn’t an even number, so therefore the median is the (7 / 2 + 1) item, which is the 4th item => 80.
Calculating the median value of …[Read more]