Skip to content

Tag: median-of-medians

How to implement the medians of medians algorithm in Java

I am trying to implement the median of medians algorithm in Java. The algorithm shall determine the median of a set of numbers. I tried to implement the pseudo code on wikipedia: https://en.wikipedia.org/wiki/Median_of_medians I am getting a buffer overflow and don’t know why. Due to the recursions it’s quite difficult to keep track of the code for me. Confirm n