mercredi 19 avril 2017

Random select and median of medians

I was planning to implement those algorithms in C++ and came upon one problem. What happens when I pass array with elements that repeats and ask for some order statistics? When I ask for a second order statistic from array [1,2,1] should it return 1 or 2 ? If 2, is there any quick way to edit those algorithm to adapt them to that kind of arrays? Is moving elements that repeats to the end of array is good way to do it?




Aucun commentaire:

Enregistrer un commentaire