Capstone. A three-minute script, one diagram, a demo, and the questions learners will ask.
Draw exactly this: a row of boxes, the last k shaded, an arrow riding the unshaded prefix left to right carrying "max". Label the shaded part "fixed after k passes". Everything in the script points at it.
Use this visualizer full-screen. Edit data-values to a learner's numbers; nothing else changes.
Backup: VisuAlgo with pseudocode highlighting.
| Question | Answer | Lesson |
|---|---|---|
| Does it start over after a swap? | No. It continues to the next pair. | 1 |
| Why n - 1 passes and not n? | After n - 1 slots are fixed the last value is forced. | 2 |
| Why does the inner loop shrink? | The fixed suffix never needs comparing again. | 2 |
| Is sorted input fast? | Only with the swapped flag: one pass, O(n). | 3 |
| How slow, really? | n(n - 1)/2 comparisons; 25,000x slower than merge sort at a million. | 4 |
| Is it stable? | Yes, because of strict >. Change to ≥ and it is not. | 5 |
| What should I use instead? | Library sort. For tiny inputs, insertion sort. | 5 |
| Why teach it at all? | Simplest sort with a real invariant and a real cost lesson. | Astrachan |
Record yourself once. Tick all five before you call it done.
Post your script and diagram on CS Educators Stack Exchange and ask which step loses beginners. Post the TypeScript on r/algorithms for accuracy. Then deliver it to one real learner and tell your teaching agent what they asked; that becomes a learning record.
Teaching the Bubble Sort Algorithm Using CS Unplugged Activities (ACM TOCE): documented learner misconceptions, so you see them coming.
Anything unclear? Ask your teaching agent - it wrote this lesson and can go deeper on any point.