Median is the central value of an arranged data.
So, first step is to arrange the given data in ascending order. So, it can be arrange as,
2,8, 19, 27, 31, 51,3335
There are total 7 data. Hence, n=7.
The central position will be .
=
-=tex] \frac{8}{2} [/tex]
=4
So, the median lies at the 4th position. 27 is there at the 4th position. So,
Median = 27