-
Notifications
You must be signed in to change notification settings - Fork 349
Open
Description
Quicksort should first randomly shuffle the container. If it doesn't and the array is already sorted, then it will actually be O(n^2), which is the worst case. By shuffling, it results in a probabilistic guarantee of О(n log n).
https://github.com/kanwei/algorithms/blob/master/lib/algorithms/sort.rb#L180
esbanarango and GarrisonJ
Metadata
Metadata
Assignees
Labels
No labels