What is difference …
 
Notifications
Clear all

What is difference between quick sort and merge sort?

1 Posts
2 Users
0 Likes
192 Views
0
Topic starter

What is difference between quick sort and merge sort?

1 Answer
0

The main difference between quicksort and mergesort is their approach to sorting elements.

  • Quicksort: It is a divide-and-conquer sorting algorithm that partitions the array around a pivot and recursively sorts the sub-arrays. It has an average-case time complexity of O(n log n) but can degrade to O(n^2) in the worst case.

  • Mergesort: It is also a divide-and-conquer algorithm that divides the array into halves, sorts them recursively, and then merges the sorted halves. It has a consistent time complexity of O(n log n) but requires additional space for merging the sub-arrays.

Share: