Find the median from the data given below in the figure.

My Attempt ;
I tried to arrange the class interval as $(0-20), (20-40), (40-60)$ but how do I adjust the classes $(0-30), (0-50)$. I am having trouble here. Please help me to solve this.
Find the median from the data given below in the figure.

My Attempt ;
I tried to arrange the class interval as $(0-20), (20-40), (40-60)$ but how do I adjust the classes $(0-30), (0-50)$. I am having trouble here. Please help me to solve this.
This is all assuming that $(0-20)$, for example, is interpreted as the interval $[0,20)$.
Hint: First figure out how many students are in $(20-30)$, $(30-40)$, $(40-50)$, and $(50-60)$.
To get you started: There are 2 students in $(0-20)$ and 10 students in $(0-30)$. Since $(0-30)$ consists of $(0-20)$ combined with $(20-30)$ then there must be $10-2 = 8$ students in $(20-30)$.
Addendum:
$(0-20)$ has frequency 2
$(0-30)$ has frequency 10, therefore $(20-30)$ has frequency $10-2=8$.
$(0-40)$ has frequency 21, therefore $(30-40)$ has frequency $21-10=11$.
$(0-50)$ has frequency 27, therefore $(40-50)$ has frequency $27-21 = 6$.
$(0-60)$ has frequency 30, therefore $(50-60)$ has frequency $30-27 = 3$.
From the above we have $(20-40)$ has frequency $8+11 = 19$ and $(40-60)$ has frequency $6+3 = 9$.
To find the median class interval, list all the intervals in "increasing" order (i.e., $(0-20)$ before $(20-40)$, etc.) as many times as the frequency indicates. So we would list $(0-20)$ two times, $(20-40)$ 19 times, and $(40-60)$ 9 times. The median class interval is the interval in the middle. Based on the frequencies this is obviously $(20-40)$.
So what about class intervals with width 10? Do the same thing: List all class intervals of width 10 in "increasing" order as many times as their frequencies indicate. How do we handle $(0-20)$? Since $(0-20)$ has frequency 2, then there are only three possibilities:
In any of these three cases, we will list two class intervals of width 10. So the median will be the same regardless of which case is actually the real situation (and because the median is clearly not $(0-10)$ or $(10-20)$ - that's also important to note).