Two stalls have sorted their prices. How could you make one sorted price list?
At a school fair in Leeds, two stalls have each listed their prices from cheapest to dearest. You want one sorted price list for the fair. What can you do with the work the stalls have already done?
When you list prices in ascending order, you start with the cheapest and work up to the dearest. Look at either stall's sorted list. Its cheapest price is at the front. If you take that price away, the next price becomes the cheapest one left.
The fronts are two and three, so take two. Now compare six with three and take three. Six is smaller than seven, so take six. With the left pile empty, copy seven. This is merging. If the two fronts are equal, you can take the left one first.
Your left pile holds two and nine. Your right pile holds four and seven. You've already moved two to the output. Which value should you take next? Pick one.
Where did those sorted piles come from? Rewind to six, two, seven, three. Split the list into two halves without changing the order. Split each half again. Each pile now has one item, so it's already sorted and ready to merge.
Split eight, four, five, one into halves, then into single items. Merge the first two singles to get four, eight. Merge the other two to get one, five. Take one, then four, then five from the fronts. Copy the remaining eight.
You've split seven, three, six, two down to single items. Now merge the first pair of singles and the second pair separately. Which two piles should appear just before the final merge? Pick an answer.
Both piles start sorted. If you copy the whole left pile first, you get two, nine, four, seven. Nine is before four, so that list isn't sorted. Compare the fronts again after every pick: take two, four, seven, then copy nine.
Bubble sort scans left to right and swaps out-of-order neighbours. Merge sort combines sorted piles. Bubble sort repeats until a pass makes no swaps. Merge sort ends with one sorted list. Bubble sort can take many passes. Merge sort usually sorts long lists faster. Bubble sort swaps in place. Merge sort typically uses extra memory.
If the exam asks you to show how merge sort sorts a list into ascending order, show each stage. Split six, two, seven, three into halves, then single items. Merge to get two, six and three, seven. For the final merge, write two, three, six, seven in the order you take them.