Donnerstag, 9. Juni 2016

Median of medians

The median of medians algorithm does actually not - as you might think - compute the median of the input. It actually computes a good pivot for the input which can then be used for quickselect or quicksort. However, the pivot is approximately near the real median. So let's see how the median of medians algorithm performs on a set of 100 random numbers:


1
2
3
3
1 2
3
3

Keine Kommentare:

Kommentar veröffentlichen