QuickSort
Advantage: Pretty fast in most cases
Disadvantage: The worst-case complexity of quick sort is O(n^2), which is worse than the O(n log n) worst-case complexity of algorithms like merge sort, heapsort, binary tree sort, etc.
One disadvantage so far not mentioned is that it is not a stable sort: the order of equal elements may not be preserved.
Disadvantage: The worst-case complexity of quick sort is O(n^2), which is worse than the O(n log n) worst-case complexity of algorithms like merge sort, heapsort, binary tree sort, etc.
One disadvantage so far not mentioned is that it is not a stable sort: the order of equal elements may not be preserved.
QuickSort is more popular because it:
- Is in-place (MergeSort requires tons of extra memory).
- Has a small hidden constant.
Subscribe to:
Post Comments
(
Atom
)
No comments :
Post a Comment