When I use Quick Select function, a case reports a stack overflow error.
The reason is at the case where n=30k+, and all the number are 1,2 and 3 (lot of duplicates).
The quick select starts to degenerated and call (begin+1, end, k-1) because almost all the items existing in range equals the target...
Anyone have ways of remedy? How to optimize quick select to cope this situation?