StudyGraph
Procedural Programming with C++ Spot it

Spot the bubble sort mistake

How many passes can bubble sort need to sort five marks?

Lesson notes

Use nested loops over 2D arrays and implement linear search and bubble sort

Key points

Takeaway: Bubble sort needs at most n−1 passes and stops when nothing swaps.

Quick check: Which step is wrong?
  1. Step 1
  2. Step 2
  3. Step 3

Each pass fixes one element, so n−1 passes suffice; a no-swap pass allows early stop.

2D arraylinear searchbubble sort

Lessons like this, for your syllabus.

Short narrated study videos written for your course, level and exam. Free to start.

Get lessons for your own syllabus