📘 Paper 2 · Topic 7: Algorithm Design & Problem Solving
7.3c Merge Sort
Cambridge IGCSE Computer Science 0478 · ~14 min read · ⭐ Pro

What is Merge Sort?

Merge sort is a more efficient sorting algorithm than bubble sort. It uses a divide and conquer strategy — it splits the list into halves, sorts each half recursively, then merges the sorted halves back together.

The two phases of merge sort

  • Split phase: repeatedly divide the list in half until you have individual elements (a single element is by definition "sorted")
  • Merge phase: repeatedly combine pairs of sorted sub-lists into a larger sorted list by comparing elements and taking the smaller one first

Step-by-step example — sorting: 8, 3, 5, 1, 9, 2

Original list
835192
Split 1 — divide in half
835
192
Split 2 — divide again
8
35
1
92
Split 3 — individual elements
8
3
5
1
9
2
Merge 1 — merge pairs (compare and take smaller first)
38
35
1
29

8+3→[3,8] | 5 stays | 1 stays | 9+2→[2,9]

Merge 2 — merge sub-lists
358
129
Final merge — sorted!
123589

The merge step in detail

When merging two sorted sub-lists, you compare the first element of each sub-list and take the smaller one into the result. You repeat until one sub-list is empty, then append the remainder of the other.

Example: merging [3, 5, 8] and [1, 2, 9]:

  • Compare 3 and 1 → take 1
  • Compare 3 and 2 → take 2
  • Compare 3 and 9 → take 3
  • Compare 5 and 9 → take 5
  • Compare 8 and 9 → take 8
  • Take remaining: 9
  • Result: [1, 2, 3, 5, 8, 9] ✓

Merge Sort vs Bubble Sort

Bubble SortMerge Sort
StrategyRepeatedly swap adjacent pairsDivide and conquer
EfficiencyLess efficient for large dataMore efficient for large data
Extra memoryIn-place (only temp var)Needs extra memory for sub-lists
ComplexitySimpler to understand and codeMore complex
Exam tip: For IGCSE, you need to be able to describe merge sort (split until individual elements, then merge back in order) and show the stages of a merge sort on a given list. You do not need to write pseudocode for merge sort. The key advantage over bubble sort is that it is more efficient for large datasets.
⚠️ Common Mistakes
  • Confusing the split phase with the merge phase — be clear which one you are showing
  • Not continuing to split until all sub-lists are size 1 before starting to merge
  • During the merge step, not picking the SMALLER element first when comparing
  • Saying merge sort uses no extra memory — it does need temporary storage for the merged sub-lists
Video coming soon
Click slide or press arrow keys to navigate
✍️

Worksheet — Merge Sort

4 questions · 11 marks

Q1Describe the two main phases of merge sort. [2]
✅ Mark scheme
Split phase: repeatedly divide the list in half until each sub-list contains a single element [1]; Merge phase: repeatedly combine pairs of sorted sub-lists by comparing elements and taking the smaller one first until one full sorted list is produced [1]
Q2Show the stages of merge sort on: 6, 4, 9, 2, 7. Show each split and each merge. [5]
✅ Mark scheme
Split: [6,4,9,2,7] → [6,4] + [9,2,7] [1]; → [6]+[4]+[9]+[2,7] [1]; → [6]+[4]+[9]+[2]+[7] [1]; Merge: [4,6]+[9]+[2,7] → [4,6]+[2,7,9] → [2,4,6,7,9] [1]; correct final sorted list [1]
Q3Give one advantage and one disadvantage of merge sort compared to bubble sort. [2]
✅ Mark scheme
Advantage: more efficient for large datasets (fewer comparisons overall) [1]; Disadvantage: requires extra memory for the sub-lists / more complex to implement and understand [1]
Q4Explain how two sorted sub-lists [2, 5, 9] and [1, 4, 7] are merged into a single sorted list. [2]
✅ Mark scheme
Compare the first element of each sub-list and add the smaller one to the result [1]; continue comparing and taking the smaller element until all elements are merged: 1, 2, 4, 5, 7, 9 [1]
Quiz — Merge Sort
Q 1 of 7
Score
/ 7
Click to reveal
TermDefinition
🎯

Mini Test — Merge Sort

10 minutes · mixed marks

← 7.3b Bubble Sort Topic 7: Algorithm Design Next: 7.3d Algorithm Efficiency →
🔒
Pro Content
Upgrade to access all lessons.
£7.99/month
or £59/year
Subscribe now →