Using the algorithm described for the median-of-medians selection algorithm, determine what the list of medians will be on the following input:
median_of_medians(A,7)
Hint
: In the code,
medians
is the list of these medians.
Bonus : Feel free to run the code and add some strategic print messages.
This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try
refreshing the page, (b) enabling javascript if it is disabled on your browser and,
finally, (c)
loading the
non-javascript version of this page
. We're sorry about the hassle.
The answer could be different depending on one's implementation. This site chooses to select the median by rounding up, whereas others might round down. If we were to select the median by rounding down for cases of arrays with even amounts, the answer would be [3,9]