Lecture 03 — Flowcharts and Control Flow

Position in the course

This is lecture 3 of 32. It belongs to the course arc described in the course outline and uses the standard interactive case method: display, attempt (5 minutes), discuss, reveal, name the technique.

Learning objectives

By the end of this lecture students can do all three under time pressure, which is what the four cases exercise.

Prerequisite knowledge

Before this lecture: Lecture 02 — Pseudocode as Precision

Assumed fluencies:

Preparation task: Redraw one of last lecture's pseudocode solutions as a flowchart before class.

Detailed topic outline

Core (mandatory):

  1. flowchart symbols and when each applies
  2. translating pseudocode ⇄ flowcharts
  3. loop preconditions and termination
  4. state machines as flowcharts

Extension (optional enrichment):

  1. tracing arrows with real data
  2. finding dead branches before coding

Case sequence

CaseTitleDifficulty
cs-009The ATM LoopBeginner
cs-010Rain or ShineFoundational
cs-144Two Paths, One PostFoundational
cs-011The Dispatch LoopIntermediate
cs-012Guess and CheckAdvanced

Display each case full-screen from the student page (cases cs-009–cs-012); instructor pages cs-009–cs-012 under case-studies/instructor/ hold the full solutions, reveal guides, and discussion prompts. Applied additions cs-144 extend the session as optional extra attempts or homework; they share the lecture's theme but teach an applied, real-world angle.

Timing plan (120 minutes)

MinutesSegment
0–10Framing: where this fits; recall of the previous lecture
10–30Case 1 (cs-009): 5-minute attempt, then discussion and reveal
30–50Case 2 (cs-010): same rhythm
50–70Case 3 (cs-011): same rhythm, harder case
70–75Break
75–100Case 4 (cs-012): same rhythm, hardest case
100–115Synthesis: name the techniques; misconceptions check
115–120Exit questions, homework, next-lecture preview

Timing flexes with the room: if a case ignites the class, let the discussion run and compress the synthesis; if the attempts stall, harvest partial attempts rather than extending the clock.

Worked examples

Instructor demonstration to open the lecture: Draw the rain-or-shine flowchart (cs-010) live, deliberately leaving one diamond without an exit; the class must catch it.

Classroom activities

#ActivityMinutesFormat and prompt
1Sketch That Flow7The main event: a numbers-free statement of cs-012, four minutes, then peer review of arrows.
2Trace the arrows6Given a completed flowchart with one dead branch, each pair traces two inputs and must state which branch is unreachable.
3Termination vote4Show two loop flowcharts; vote which terminates and name the quantity that guarantees it.

Board plan

Instructor explanation notes

Reading the room. Flowcharts earn their keep on termination and dead-branch questions, where pseudocode is weak. Emphasise the arrow discipline: every diamond has exactly two labelled exits.

Running the reveal. Mixed-background note: beginners draw, experienced students verify — assign roles deliberately in pair work.

Lecture focus. One sentence to repeat verbatim: Every diamond exits twice; every loop names what shrinks.

Common misconceptions

Each case's instructor page lists the specific wrong turn to expect; the reveal should address it by name.

Student practice exercises

Core:

  1. Redraw your cs-009 ATM pseudocode as a flowchart; mark the diamond exits.
  2. Prove on the flowchart that cs-011 terminates by naming the decreasing quantity.
  3. Find and fix the dead branch in a provided guess-the-game flowchart.

Enrichment (optional):

Formative assessment

Exit questions (choose one; answer on a card in 60 seconds):

  1. Every decision diamond must have how many exits, and how labelled? Expected: exactly two, labelled with mutually exclusive conditions
  1. What is the standard proof that a loop terminates? Expected: name a quantity that strictly decreases (or increases) and is bounded
  1. What is a dead branch and how do flowcharts expose one? Expected: an unreachable path; exposed by tracing arrows from start with all conditions

Cards are skimmed before the next lecture; three answers become the framing. Persistent wrong answers route students to the review stations of lecture 16 or to office hours.

Homework and preparation

Learning-outcome mapping

Differentiation