Compare the quick-sort and merge-sort algorithms in terms of their time and space complexity. Which is better in terms of time complexity? Which is better in terms of space complexity? code example
Example: merge sort vs quicksort
Efficiency :
Merge sort is more efficient and works faster than quick sort in case of larger array size or datasets.
whereas
Quick sort is more efficient and works faster than merge sort in case of smaller array size or datasets.
Preferred for :
Quick sort is preferred for arrays.
whereas
Merge sort is preferred for linked lists.