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?
Asked
Active
Viewed 210 times
0
-
This feels like a very broad question and I'm not 100% clear what you are asking. – doctorlove Apr 20 '17 at 08:22
-
How to do rand select or median of medians select when my array has elements that appear more than once in array. If I have array [1,2,1] and I ask for second order statistic my rand select should return 1 or 2? – ogarogar Apr 20 '17 at 11:41