August 2024
Beginner
216 pages
5h 24m
English
A merge sort is more efficient than a bubble sort. The merge sort repeatedly divides the list in half, until each list consists of a single item. The single list items are then merged together so that they are in order. Let’s look at an example.
First divide the list into the smallest items (ie divide the list in half and half again until you’re left with individual items).

Once you have the individual items, merge and order the list back together. If you’re sorting in ascending order, swap the items if the first one is bigger than the second one, see below:
Merge the next list back together. Take item 1 from the first list and compare ...
Read now
Unlock full access