Hi Pavan,
Thank you for your amazingly fast reply as usual.
Yes currently I'm doing something similar to what you suggest (ie. taking a random sample, getting the max and then filtering the input with that threshold value). It's inaccurate though and suffers some calibration need (ie. size of the sample / the 0.01 value), which if I get wrong it messes up.
If I replace the estimate methodology with sort() it increases the runtime by about 4x the estimate method.
I guess all I need is something that would tell me what would the value be at position n if the array was sorted. I don't need the array to be sorted, not even the first part of it to be sorted (like std::nth_element guarantees). Because I can then use that threshold value to find the guys in the array that are greater than it.
What would be the best way to get the threshold value accurately? Do I have to resort to sort or is there another way?
Kind regards,
Muneer