Combine quick-select and quick-sort