Merge sort is a more complicated sorting algorithm.
The steps to do a merge sort are as follows:
1. Keep splitting the list in half until all sublists contain one item
2. Repeatedly merge and sort pairs of sublists into larger sublists
3. Eventually, the whole list will be reconstructed in order
Diagram 1 shows an example run of merge sort on a list of numbers.
Diagram 1
Which sorting algorithm is more efficient in the worst case: merge sort or bubble sort?
Tap/click to reveal
Merge sort (with a worst case time complexity on the order of O(n log n)) is much more efficient than
bubble sort (worst case on the order of O(n2)), especially for larger lists.