📁 Topic 1 · 1.1 Algorithms
1.1h Merge sort
Edexcel 4CP0 · iGCSE Computer Science · ~10 min read
Notes
──
Video
──
Slides
──
Worksheet
──
Quiz

What is Merge Sort?

Merge sort is an efficient sorting algorithm based on the divide and conquer principle. It works by recursively splitting the list in half until each sub-list contains only one element (which is trivially sorted), then merging the sub-lists back together in the correct order.

How Merge Sort Works — The Two Phases

Phase 1: Divide (Split)

  1. Take the list and find the midpoint
  2. Split into two halves
  3. Repeat for each half until every sub-list has only 1 element

Phase 2: Conquer (Merge)

  1. Take two sorted sub-lists and merge them into one sorted list
  2. Compare the first element of each sub-list; take the smaller one
  3. Repeat until one sub-list is empty; append the remaining elements
  4. Repeat the merge process up the tree until the full list is reconstructed

Worked Example

Sort: [38, 27, 43, 3, 9, 82, 10]

Split phase:

  • [38, 27, 43, 3, 9, 82, 10]
  • [38, 27, 43] and [3, 9, 82, 10]
  • [38] [27, 43] and [3, 9] [82, 10]
  • [38] [27] [43] and [3] [9] [82] [10]

Merge phase:

  • [27, 38] [43] → [27, 38, 43] and [3, 9] [10, 82] → [3, 9, 10, 82]
  • [27, 38, 43] + [3, 9, 10, 82] → [3, 9, 10, 27, 38, 43, 82]

Comparison: Merge Sort vs Bubble Sort

FeatureBubble SortMerge Sort
Time complexity (worst)O(n²)O(n log n)
MethodCompare adjacent pairs and swapDivide, then merge sorted halves
Suitable for large listsNo — too slowYes — much more efficient
Memory usageIn-place (no extra memory)Requires extra memory for sub-lists
SimplicitySimple to implementMore complex to implement
📝 Exam Tip: In Paper 1, you may be asked to show the state of the list at each stage of merge sort — both the split phase (tree diagram) and the merge phase. Practice drawing the split tree clearly.
⚠️ Common Mistakes
  • Forgetting that merge sort has two distinct phases: splitting AND merging
  • Merging incorrectly — always compare the front elements of each sub-list and take the smaller
  • Saying merge sort is O(n²) — it is O(n log n), which makes it much more efficient than bubble sort for large datasets
← 1.1g Bubble Sort Topic 1 · 1.1 Algorithms Next: 1.2 Decomposition →
🔒
Pro Content
Subscribe to access all 47 Edexcel iGCSE lessons.
£7.99/month
or £59/year