1 student has a thesis length of 0-9 pages
4 students have a thesis length of 10-19 pages
6 students have a thesis length of 20-29 pages
7 students have a thesis length of 30-39 pages
2 students have a thesis length of 40-49 pages
Hence, total number of seniors = (1 + 4 + 6 + 7 + 2) = 20
Therefore, median length of theses, i.e. the average length of 10th and 11th longest theses is between 20 and 29 pages.
Even if the lengths of 10th and 11th longest theses is placed as far as they can be, i.e. 20 and and 29 pages, they will be always within 6 pages from the median.
a) We can place the lengths of 10th and 11th longest theses as close as possible to place the lengths of other pages as far as possible. Say, the lengths of 10th and 11th longest theses are 27 and 28. Hence, median length of the theses = (27 + 28)/2 = 27.5
Now, if the other four theses with lengths 20-29 pages are of length 20 or 21, and seven theses with lengths 30-39 pages are of length 34 or more, then they are not within six pages of 27.5.
Hence, least possible number of seniors whose theses were within six pages of the median length = 2
a) We can choose the lengths of 10th and 11th longest theses in such a way that the median is midway between 20 and 29. By doing so we can make the lengths of these with length 10-19, 20-29, and 30-39 pages to come as close as possible to the median.
Say, the lengths of 10th and 11th longest theses are 24 and 25. Hence, median length of the theses = (24 + 25)/2 = 24.5
Now, if the other four theses with lengths 20-29 pages are of any length between 20 and 29, they will be within six pages of 24.5
And, if the seven theses with lengths 30-39 pages are of length 30 and the four theses with lengths 10-19 pages are of length 19 then they will be also within six pages of 24.5.
Hence, greatest possible number of seniors whose theses were within six pages of the median length = (2 + 4 + 7 + 4) = 17