Sorting: merge sort and comparing algorithms
Merge sort is a 'divide and conquer' algorithm. It is much faster than bubble sort on big lists, which is why real programs use ideas like it.
Divide
6, 2, 8, 4, 7, 1, 5, 3 splits into 8 single items.
Conquer: merge
| Stage | Lists |
|---|---|
| Single items | 6 | 2 | 8 | 4 | 7 | 1 | 5 | 3 |
| Merge into pairs | 2, 6 | 4, 8 | 1, 7 | 3, 5 |
| Merge into fours | 2, 4, 6, 8 | 1, 3, 5, 7 |
| Final merge | 1, 2, 3, 4, 5, 6, 7, 8 |
Choosing an algorithm
| Item | Bubble sort | Merge sort |
|---|---|---|
| Ease of coding | Very easy | Harder |
| Speed on large lists | Slow | Much faster |
| Extra memory | None needed | Needs extra memory for the merged lists |
| Best for | Small or nearly sorted lists | Large lists |
Merge the sorted lists 2, 5, 9 and 3, 4, 8 into one sorted list.
- Compare 2 and 3: take 2.
- Compare 5 and 3: take 3. Compare 5 and 4: take 4.
- Compare 5 and 8: take 5. Compare 9 and 8: take 8.
- Only 9 is left: take it.
Answer: 2, 3, 4, 5, 8, 9
Merge sort splits a list into single items, then merges them back in order. It is faster than bubble sort on large lists but harder to code and uses more memory. Choose an algorithm by speed, memory and simplicity.
- Merge sort
- A divide and conquer sort that splits a list into single items, then merges them back together in order.
- AND
- A Boolean operator that gives True (1) only when both inputs are True.
- Algorithm
- A precise set of step-by-step instructions to solve a problem or complete a task.
- Bubble sort
- A sort that compares neighbouring pairs and swaps them if they are in the wrong order, making passes until no swaps are needed.
- List
- A data structure that stores many items under one name, in order, such as scores = [4, 7, 2].
- Not “Linear search”. Linear search finds items; it does not sort them.
- Not “Binary search”. Binary search finds items in a sorted list; it does not sort.
Try two quick questions
See if it has sunk in. Answers are marked straight away.
2 more questions
Try each one, then tap to check.
Merge 2, 5 and 3, 8 into one sorted list. Separate the numbers with commas.
Show the answer
Answer: 2, 3, 5, 8
Compare the first items each time and take the smaller: 2, 3, 5, 8.
Merge 2, 6, 11 and 4, 9 into one sorted list. Separate the numbers with commas.
Show the answer
Answer: 2, 4, 6, 9, 11
Compare the first items each time and take the smaller: 2, 4, 6, 9, 11.
Check you have got it
Answer 6 quick questions with instant marking. If you get one wrong, GCSE-ready shows you why and gives you another go. It is free, and you do not need an account.
Facts checked against the sources below, 27 October 2026. Last updated 2 October 2026. Spotted a mistake? Tell us and we will fix it.