05/08/2023 9:45 am
Topic starter
Notifications
Clear all
What is difference between quick sort and merge sort?
0
What is difference between quick sort and merge sort?
Answer
Add a comment
Add a comment
1 Answer
0
06/08/2023 5:55 am
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.
Add a comment
Add a comment
Forum Information
- 14 Forums
- 1,836 Topics
- 5,052 Posts
- 0 Online
- 1,078 Members
Our newest member: Richardnop
Latest Post: loli
Forum Icons:
Forum contains no unread posts
Forum contains unread posts
Topic Icons:
Not Replied
Replied
Active
Hot
Sticky
Unapproved
Solved
Private
Closed