Overview
One class period. Students meet the three building blocks of algorithms: sequencing, selection, and repetition (2.1.A.1 to 2.1.A.3). They trace algorithms with a decision and with a loop, show them as numbered steps and as flowcharts with a decision diamond (2.1.A.4), and see that changing the order of the blocks changes the result (2.1.A.5).
Stay inside the topic boundary. Selection and repetition are taught as ideas in plain-language steps and flowcharts; the Java if statement is Topic 2.3 and loops are Topics 2.7 and 2.8. The only Java is two short sequencing examples, plus the Math.abs and indexOf methods that students already know from Topics 1.11 and 1.15.
Teacher note
The slides are the Decide and Repeat deck (21 slides, with speaker notes); slide numbers below refer to it. The puzzle worksheet has 10 questions and takes about 35 minutes. Do question 1 after the building-block segment and question 2 after the repetition segment if you want to check understanding in class; the rest (questions 3 to 10) is homework. In every written algorithm on the worksheet, a “Repeat until” step checks its goal before each pass and stops as soon as the goal is true; say this aloud once.
Examples are in the topic’s examples/ folder. Use BonusThenDouble and DoubleThenBonus for the order-matters segment. AbsDecision, IndexOfSearch, and FinalScoreWrong are in the study guide and need not be shown in class.
Warm-up: Same list, different day
Show slide 2, the morning routine. Students talk with a partner: which steps happen every day exactly once, and which can change? Take two or three answers. Look for “the umbrella step” (depends on rain) and “brushing” (depends on how long it takes). Do not name the building blocks yet.
Direct instruction: Sequencing, selection, repetition
- Goals (slide 3).
- Three building blocks (2.1.A.1, slide 5). Sequencing is steps done in order, each once. Selection is a decision that chooses the next step; another name is decision making. Repetition is repeating steps until a goal is reached; another name is looping, and the repeated steps are a loop.
- Find them in the routine (slide 6). Go down the table: steps 1 and 4 are sequencing, step 2 is selection, step 3 is repetition. Stress that the whole list is still a sequence. Selection and repetition live inside the order.
- A recipe that stirs three times (slide 7). Three separate “Stir” steps are still sequencing, and three is a guess. “Stir until there are no lumps” is repetition because the goal decides when to stop.
Misconception: Writing a step several times is repetition
Students list the same step three times and call it a loop. Ask: “What if the batter needs twenty stirs?” Real repetition is one instruction plus a goal.
Direct instruction: Selection and the condition
- A decision chooses the next step (2.1.A.2, slide 9). Selection depends on a true or false decision; the question is the condition. Walk the flowchart with a rainy day and a sunny day: each takes one arrow out of the diamond.
- Pause and try (slide 10). Students trace “if the score is at least 70, say pass; otherwise say try again” for 85, 70, and 64: pass, pass, try again. 70 is the case to discuss, because “at least” includes the boundary.
Misconception: A decision that is not a true-or-false question
“Decide what to wear based on the weather” cannot be followed by a literal reader, because the weather is not true or false and no step says what to do for each case. A decision needs a condition that is true or false, such as “Is it raining?”
Direct instruction: Repetition, passes, and infinite loops
- A loop repeats until its goal is reached (2.1.A.3, slide 12). Trace the jug table row by row: check the goal first, pour 3 if it is not met. Each time through is a pass. It takes 4 passes and the jug ends at 12 cups, not 10, because the check happens before each pass.
- A goal that is never reached (slide 13). Starting at 0 and adding 2 until x is 7 jumps from 6 to 8 and never equals 7. This is an infinite loop. Give students 30 seconds to change one thing so the loop stops (change 7 to 8, or start x at 1, or add 1). Collect more than one fix.
Misconception: Repeat until means stop when the goal is passed
The goal is checked for being exactly true. In the 6-to-8 example, x passes 7 without ever stopping on it. Ask students to write the values after each pass before they decide the loop stops.
Misconception: A backward arrow can point anywhere
If the arrow back in a flowchart goes to a step that resets the value (for example, back to “Set savings to $0”), every pass undoes the last one and the goal is never reached. Have students trace two passes before trusting a flowchart.
Direct instruction: Words and flowcharts
- Flowchart pieces (2.1.A.4, slide 15). Start and Stop, a step box, a decision diamond with a true arrow and a false arrow, and an arrow back for repetition.
- The jug loop as a flowchart (slide 16). A loop is a decision plus an arrow back. The diamond asks about the goal before each pass, and the true arrow leaves the loop. Have students match each line of the written version to a shape.
Guided practice: Order matters
- Add, then halve (2.1.A.5, slide 18). Show
BonusThenDoubleandDoubleThenBonus. Students predict the two outputs (Points: 30andPoints: 25), then run or reveal them. Same two steps, different order, different result. The same is true when a step moves inside or outside a loop or before or after a decision.
int points = 10;
points += 5;
points *= 2;
System.out.println("Points: " + points);int points = 10;
points *= 2;
points += 5;
System.out.println("Points: " + points);- Where does the decision go? (slide 19). Version A checks the water once, after the loop. Version B checks it inside the loop on every dish, so only version B can drain the sink more than once. Students answer with a partner, then share.
Misconception: Same steps, same result
Students check that an algorithm has all the right steps and stop there. Ask every time: “What has already happened by the time this check is made?” Trace with a value near the edge.
Independent practice: Independent practice
Hand out the Decide and Repeat puzzle worksheet. If time allows, students start question 1 (sort the steps) in class. Questions 3 to 10 are homework. Question 3 settles the Think First guess from question 2’s page (add the bonus, then double: 90). Question 6 fixes a loop that never stops.
Closure: Closure and exit ticket
Show slide 21. Partners finish the sentence starter: “Selection _ once and picks a path, but repetition _ until ___.” Then give the exit ticket (about five minutes). Question 1 checks the three building blocks (2.1.A.1 to 2.1.A.3), question 2 checks tracing a loop (2.1.A.3), and question 3 checks that order changes the result (2.1.A.5). Slide 20 (vocabulary) is for students to keep as a reference. Re-teach the weakest question at the start of Topic 2.2.