Skip to main content

Difference between Quick Sort and Merge Sort .

Document
Quick Sort Merge Sort
In case of quick sort, the array is parted into any ratio. In the merge sort, the array is parted into just 2 halves (i.e. n/2).
Quick sort is an internal algorithm which is based on divide and conquer strategy Merge sort is an external algorithm and based on divide and conquer strategy.
The worst case complexity of quick sort is O(n2) as there is need of lot of comparisons in the worst condition. In merge sort, worst case and average case has same complexities O(n log n).
Quick sort is more efficient and works faster than merge sort in case of smaller array size or datasets. Merge sort is more efficient and works faster than quick sort in case of larger array size or datasets.
Quick sort is unstable in this scenario. But it can be made stable using some changes in code. Merge sort is stable as two elements with equal value appear in the same order in sorted output as they were in the input unsorted array.
Quick sort is preferred for arrays. Merge sort is preferred for linked lists.
Posted by -