Why quicksort is better than mergesort ?

Last updated:9/23/2020 5:11:03 PM

1 Answers

Prakash nidhi Verma
Prakash nidhi Verma

Auxiliary Space :

 Mergesort uses extra space but quicksort requires little space. Quick sort is in-place sorting algorithm. In-place sorting means no additional storage space is needed to perform sorting. Merge sort requires a temporary array to merge the sorted arrays. it is not in-place giving Quick sort the advantage of space.

Worst Cases :

 The worst case of quicksort O(n2) .It can be easily avoided with high probability by choosing the right pivot. obtaining the data in quick sort,its improvise the performance and becoming as efficient as Merge sort.

Locality of reference :

 Quicksort having particular exhibits good cache locality and its make it faster than merge sort in any cases like in virtual memory environment. Merge sort is better for large data structures, Mergesort is a stable sort, while quicksort and heapsort.