Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
AK: Change pivot selection of dual_pivot_quick_sort
Picking the first and last elements as pivots makes it so that a sorted array is the worst-case input for the algorithm. This change instead picks pivots at approximately 1/3 and 2/3 in the array. This results in desired performance for sorted arrays. Of course this only changes which inputs result in worst-case performance, but hopefully those inputs occur less frequently than already sorted arrays.
- Loading branch information