A Way For Learning

QuickSort

No comments
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.

QuickSort is more popular because it:
  1. Is in-place (MergeSort requires tons of extra memory).
  2. Has a small hidden constant.

No comments :

Post a Comment