Teach

Published lessons and reference material.

6 documents

Bubble sort

Teach bubble sort to students and junior engineers through short, visual-first lessons.

  1. Lesson 1: One pass, by hand

    Bubble sort · lesson

    The single idea learners must own before anything else: a pass carries the largest element to the end.

  2. Lesson 2: The invariant

    Bubble sort · lesson

    One sentence that makes bubble sort obviously correct, and answers "why n - 1 passes".

  3. Lesson 3: Full algorithm and early exit

    Bubble sort · lesson

    Assemble the passes, then add the one flag that gives an O(n) best case.

  4. Lesson 4: Counting the cost

    Bubble sort · lesson

    Derive n(n - 1)/2 on the board, then show learners what quadratic feels like.

  5. Lesson 5: Stability and insertion sort

    Bubble sort · lesson

    Two questions every sharp learner asks: "does it keep ties in order?" and "what should I use instead?"

  6. Lesson 6: Teach it

    Bubble sort · lesson

    Capstone. A three-minute script, one diagram, a demo, and the questions learners will ask.