Single lesson · Key Stage 3

Bubble sort – Year 9 Computing lesson

Pupils learn to carry out a bubble sort by hand, showing the list after each pass, and explain how the algorithm knows the list is sorted.

Also in a bundle Searching and Sorting – Year 9 Computing lessons 6 lessons for £20 · save 16% on buying separately

Lesson 4 of 6 in unit 9.2 Searching and Sorting, taught in Year 9, Autumn 2. It answers one big question: How does a computer sort a list one swap at a time?

By the end, pupils can carry out a bubble sort by hand, showing the list after each pass, and explain how the algorithm knows the list is sorted.

The Build (the main task)
Complete a bubble sort of six books' loan counts (12, 5, 18, 3, 9, 14) into ascending order. Write the list after every pass and the number of swaps in that pass, then state how you know the list is sorted.
Support version
Part-filled pass table: the first pass is done compare by compare, and every later row shows which pairs to compare; pupils fill in the swaps and the list.
Challenge
Modify the bubble sort program to sort from highest to lowest, and state the most passes a list of 10 items can need.
Real-world link
When a shopper clicks 'sort by price', the shop's computer has to put every item in order – pupils sort library loan counts the same way.
Key words
Bubble sort, Pass and Compare, each with a definition, an icon and a common mix-up on the key vocabulary slide.
Misconceptions it tackles
“One pass of a bubble sort is enough to sort the list”; “A pass is one swap”.
National Curriculum
NC2 (key algorithms (e.g. searching and sorting); compare alternative algorithms); NC3 (two or more languages, at least one textual; data structures; modular programs with procedures or functions).

Every lesson follows the same Code & Commerce structure: a Bell Task recall starter, key vocabulary with definitions and icons, short teaching chunks with a check before pupils move on, The Build (one main task), challenge questions that get harder, and an exit question. Answers reveal one at a time on the slides, and everything is editable PowerPoint and Word.

Also sold in the Searching and Sorting unit bundle, which includes the medium term plan, and in the full-year and complete-course bundles.

What's included

  • Slide deck (PowerPoint)
  • Lesson plan (Word)
  • Worksheet (Word)
  • Support worksheet with scaffolds (Word)
  • Single-teacher licence: use and adapt it with your own classes

More for KS3 Computing

See all

Written for the specifications named. Not endorsed by or affiliated with any exam board.