Sorting Algorithms

GCSE Computer Science · Algorithms

Bubble sort

Repeatedly compare adjacent pairs and swap if out of order. Each full pass "bubbles" the next largest value to the end.

Pass 1 on [5,3,8,1]:
3,5,8,1 → 3,5,8,1 → 3,5,1,8   (8 now at the end)
  • Simple but slow; up to n² comparisons.

Insertion sort

Build a sorted section one item at a time, inserting each new card into its correct place (like sorting a hand of cards).

  • Efficient for small or nearly-sorted lists.

Merge sort

Divide and conquer:

1. Split the list in half repeatedly until each part has 1 item
2. Merge pairs back together in order
  • Fast on large lists (n log n) but uses more memory.

Comparison

AlgorithmSpeedMemoryBest for
BubbleSlowLowTeaching / tiny lists
InsertionMediumLowSmall / nearly sorted
MergeFastHigherLarge lists

Exam tip

Be ready to show each pass of bubble sort — write the whole list after every full pass, and remember merge sort's strength is speed on large data.

Don't understand a part?

Sign in and ask our AI tutor to explain any passage in plain English.

Try AI explanations →

More on Algorithms

Searching Algorithms Computational Thinking

← All GCSE Computer Science notes