Merge sort and quick sort__
Merge sort and quick sort__
Time Complexity
Best Case: O(n log n)
Average Case: O(n log n)
Worst Case: O(n2)
The elements are split into two sub-arrays (n/2) again and again until
only one element is left.
Merge sort uses additional storage for sorting the auxiliary array.
Merge sort uses three arrays where two are used for storing each
half, and the third external one is used to store the final sorted list
by merging other two and each array is then sorted recursively.
At last, the all sub arrays are merged to make it ‘n’ element size of
the array.
Time Complexity
Best Case: O(n log n)
Average Case: O(n log n)
Worst Case: O(n log n)