You want to sort number cards into two trays. Tray A is for numbers five or more, and tray B is for numbers below five. Cards 4 and 6 are easy to place. The interesting card is 5.
A trial rule says, “If the number is greater than five, put it in tray A. Otherwise, put it in tray B.” That rule works for 4 and 6, but it sends 5 to the wrong tray. The phrase five or more includes five; greater than five does not.
Set up the test
Make three cards numbered 4, 5 and 6. Place them in an unprocessed pile with 4 ready to be taken first. Label the empty trays A: five or more and B: below five.
In pairs, one student can follow the instructions while the other records each comparison and destination. Keep the intended sort visible, but ask the student running the algorithm to follow the written rule exactly. If someone quietly moves 5 to the tray that seems sensible, the class won’t see the mismatch they’re trying to find.
Follow every step
An algorithm is an ordered set of instructions. This one includes a comparison, two possible paths and a stopping instruction:
- If no unprocessed cards remain, stop.
- Take and remove the next card from the unprocessed pile.
- If its number is greater than five, put it in tray A. Otherwise, put it in tray B.
- Return to step 1.
The comparison is either true or false. A true result follows the first path; a false result follows the “otherwise” path. This kind of comparison-based branching sits within Years 3–4 introductory programming.
Watch where 5 goes
| Card | Is it greater than 5? | Actual tray | Intended tray |
|---|---|---|---|
| 4 | False | B | B |
| 5 | False | B | A |
| 6 | True | A | A |
Four goes to B and matches the goal. Six goes to A and also matches. Five exposes the problem: “5 > 5” is false, so the rule sends it to B, even though tray A is meant to include five.
This makes 5 the boundary test—the number at the exact point where the decision changes. Testing only 4 and 6 would leave this particular mismatch hidden.
Change the comparison, then run it again
Replace greater than five with greater than or equal to five, written as ≥ 5. Don’t change the branches, card order, repetition or stopping step.
Empty the trays, restore the cards and trace the complete algorithm again. “4 ≥ 5” is false, so 4 goes to B. “5 ≥ 5” is true, so 5 goes to A. “6 ≥ 5” is also true, so 6 goes to A. The same test cards now match the stated goal.
The first trace showed a specific difference between the intended and actual result. The second trace checks whether the one targeted change fixes that difference. This is a simple form of debugging: finding and repairing a mismatch in the instructions.
Make sure the algorithm stops
Each pass removes one card from the unprocessed pile. After 6 is placed, the algorithm returns to step 1, finds that the pile is empty and stops. You can also begin with an empty pile to check that it stops immediately.
The task brings together sequencing, branching and repetition from Years 3–4 Digital Technologies. Students are tracing a paper model of an algorithm here; they aren’t running a digital program.
Finish by asking, “Why did changing the comparison move 5 but not 4 or 6?” The useful explanation is that 5 is equal to the cut-off. Adding “or equal to” changes its result from false to true, while the results for 4 and 6 stay the same.