GCSE · Computer Science · AQA · Spec 8525
Merge sort
Here's a strange way to sort: pull the list completely to pieces first, then build it back up in order. It sounds backwards, yet it usually beats bubble sort.
Merge sort · step by step
Take it apart, then put it back in order
Step through one whole merge sort of eight numbers. Watch the list fall apart into single items, then snap back together in order.
Before you press Next: how many comparisons do you think merge sort makes while it is splitting this list?
| Stage | Lists | Comparisons so far |
|---|---|---|
| Start | [6 2 8 4 3 7 1 5] | 0 |
Output
Step 1: One unsorted list of eight numbers. Keep an eye on the right-hand column.
Press Next (or Play) and watch the right-hand column. It stays at 0 for longer than you might expect.
The price of splitting
Reason it through
Why isn't merge sort the best choice every time?
First link · your turn
What does merge sort have to do before it can compare anything?
WHAT YOU'VE LEARNED
A quick recap of today's lesson.
Take the list completely apart, then build it back up in order.
What you need to know
- Merge sort works in two phases: split, then merge.
- Splitting keeps halving the list until every item is in a list of its own. Nothing is compared or put in order while this happens.
- Merging combines two sorted lists by comparing their front items and taking the smaller, over and over. When one list runs out, the rest of the other goes on the end.
- Pairs of lists keep merging until one sorted list remains.
- Compared with bubble sort, merge sort is usually faster to execute, but it is more complex to write, uses extra memory, and can be slower on small data sets.
The big picture
Merge sort is a divide-and-conquer sorting algorithm. It splits a list until every item sits in a list of its own, then merges pairs of sorted lists, always comparing the two front items and taking the smaller, until one sorted list remains. It is usually faster to execute than bubble sort, but it is more complex to write, takes up extra memory, and on small data sets a simpler algorithm such as bubble sort can be faster.
Key points
Worked example
Problem
A program needs to sort 12 readings on a small device with very little spare memory. Should it use merge sort or bubble sort? Explain the choice.
⚠ Watch out
Thinking merge sort sorts while it splits. Splitting only breaks the list up: [6 2] is still 6 then 2. All the ordering happens in the merges. The other slip: 'merging' by sticking one list onto the end of the other instead of comparing front items.
Memory hook
Smash it to singles, then zip it back up: front against front, smaller one first.
Check yourself
Without scrolling up: name the two phases of merge sort, say which phase makes all the comparisons, and explain why a list with only one item in it never needs sorting.
Flashcards
(12)What are the two phases of merge sort?
When does merge sort stop splitting?
Why is a one-item list a good place to stop splitting?
During a merge, which items get compared?
During a merge, one list runs out. What happens to the other list's items?
In which phase are items actually put in order?
How do you know merge sort has finished?
Why is merge sort called 'divide and conquer'?
Merge sort vs bubble sort: which is usually faster to execute?
Merge sort vs bubble sort: which is more complex to write?
What does executing merge sort cost besides time?
Why can bubble sort beat merge sort on a small data set?
Tap any card to flip it, or use Study as deck to go through them one at a time. In the full lesson these run as a spaced-repetition deck — you rate each card Hard, Good or Easy and the tricky ones keep coming back until they stick.
Learning with Lightbulb is opening soon
You can use this lesson now. Join the waitlist and we'll let you know when the full Lightbulb experience is ready.
Keep me postedMore AQA GCSE Computer Science topics
How this lesson was checked. This AQA GCSE Computer Science (specification 8525)lesson was published through Lightbulb Learning's human-designed editorial process — the educational standards, accuracy rules and publication checks it must pass were authored and approved by Philip Halpin. It passed subject-specific assessment, automated educational checks and technical publication verification before going live (publication checks completed 8 November 2026). Published pages are monitored, human spot-checking is ongoing across the lesson library, and anything found wrong is corrected or withdrawn. How our lessons are made and checked. Spotted a mistake? Email hello@lightbulblearning.co and we'll review it.