Implement quickselect selection algorithm.