← Year 7 Space

Algorithms for classifying shapes

An algorithm is a clear set of steps and decisions. A classification algorithm asks yes/no questions about a shape's sides and angles, in an order that gives each shape its own name, and you test it on one shape of every class.

How do bird-watchers name a bird they have never seen before? They follow a key of yes-or-no questions.

An algorithm is a precise set of steps, including decisions, that always gives the right result. A classification algorithm sorts shapes into classes by asking yes/no questions about their attributes (sides, angles, parallel sides). It can be drawn as a flowchart or a decision tree, or written as numbered steps (pseudocode).

Two things make one work: every shape reaches exactly one answer, and the questions are in the right order.

How this lesson works: Predict, Try, Investigate, Modify, Practise, Make
Info

A bird key

This is the kind of key bird-watchers use. You answer each question, follow the arrow, and end up at a name. Try it for a galah, which is pink and grey: which questions do you answer on the way?

Later you'll build keys like this for shapes, and at the end you'll come back and put this one to the test.

A key for five birds. Is it mostly black and white? Yes: Australian magpie. No: is it white with a yellow crest? Yes: sulphur-crested cockatoo. No: is it pink and grey? Yes: galah. No: is it mostly red? Yes: crimson rosella. No: superb fairy-wren.
A key for five common Australian birds
PredictRead the problem and decide what you think before you try anything. A wrong guess is fine: it shows you what to look for.

An algorithm with one question

Would you be happy with that answer from a sorting machine?

An algorithm asks only: 'Are two sides equal? Yes: isosceles. No: scalene.' A triangle has sides 4, 4 and 4. What does it say?

TryTry it on the board and compare the result with your prediction.

Follow the algorithm

Read each shape's description, answer the question, and press the button to go on.

Try it yourselfYour edits are saved in this browser.

Follow this two-question algorithm for each triangle in turn. How does it name the 4, 4, 4 triangle? Compare with your prediction.

Use the board. This ticks when you get there.

InvestigateWork out why it happens, one step at a time.

What goes wrong

Which class does the algorithm confuse with another?

Read Pia's working. What name did the rectangle get?

How can you fix the one-question triangle algorithm?

Pia tests her algorithm on a rectangle. Click the line where she wrongly decides it works.

How should you test a classification algorithm?

ModifyChange the problem on purpose and see what happens.

Design and test

Measure first. Which question is the most specific?

Try it yourselfYour edits are saved in this browser.

Put the steps of a triangle algorithm in order.

Pieces (click to add)
    Your program

      Run the fixed algorithm on all three triangles. Does every one get the right name?

      Use the board. This ticks when you get there.

      Run the quadrilateral algorithm on all five shapes.

      Use the board. This ticks when you get there.

      A kite (two pairs of equal neighbouring sides, no parallel sides) is put through the quadrilateral algorithm. What happens?

      PractiseA few on your own, to check you have it.

      Tracing algorithms

      Try it yourselfYour edits are saved in this browser.

      In the fixed triangle algorithm, how many questions does a scalene triangle need before it is named?

      A rhombus (four equal sides, angles 60° and 120°) goes through the quadrilateral algorithm. Which answers does it give, in order?

      The quadrilateral algorithm asks at most how many questions before naming any of its five shapes?

      Review: a triangle has angles 90°, 45° and 45°. How many of its sides are equal?

      MakeMake your own problem using what you have learned. Expect a few tries; that is normal.

      Back to the bird key

      A key for five birds. Is it mostly black and white? Yes: Australian magpie. No: is it white with a yellow crest? Yes: sulphur-crested cockatoo. No: is it pink and grey? Yes: galah. No: is it mostly red? Yes: crimson rosella. No: superb fairy-wren.
      The bird key from the start

      Use the key above. The myna's colours are from the Australian Museum.

      Need a hint?

      Before a hint: what kind of stuck is this? Try a strategy first

      Follow each bird one question at a time.

      Another hint

      Which bird answers no to every question? Where does the last 'no' send it?

      A real key also has to work for plain birds: female superb fairy-wrens are mostly brown, not blue (Australian Museum). Draw the key in your book, then follow one through it.

      Stretch: write an algorithm that sorts triangles by their angles into acute, right-angled and obtuse. Test it on one triangle of each class, and say how it works to a partner.

      Also used in

      • Science. The same kind of key identifies living things: Who is it? Using a key.
      • Which bin? Council recycling guides ask yes-or-no questions about an item until it reaches the right bin.
      • Spam filters. An email program asks questions about each message before sorting it into the inbox or junk.
      Need a hint?

      Before a hint: what kind of stuck is this? Try a strategy first

      One box for each question. Draw an arrow out for yes and another for no.

      Another hint

      Write her answer next to each question as you go.

      Test the key with six birds: a magpie, a galah, a sulphur-crested cockatoo, a crimson rosella, a blue male superb fairy-wren, and a common myna (brown, with a black head and a yellow bill). Which bird gets the wrong name?

      How should the key be fixed?

      Draw your fixed key on paper as a flowchart: the five questions, then 'Bright blue on its head?' before the fairy-wren, with 'not in this key' on its no. Now take a female superb fairy-wren, mostly brown, and follow her through. Where does she end up, and why?

      Work it out on paper first, one step per line. Then choose the reasons below.

      Why does she end at 'not in this key'?

      Now you can
      Practise this skillNew questions, new numbers each timeGet 3 right in a row to mark it practised.Finished the year?Go over it: Year 7 maths recapEvery idea in one place, to check you've got it.You reached the endBack to Year 7 Space
      For teachers

      Students follow, fix and test algorithms that classify triangles and quadrilaterals, and describe how each works (AC9M7SP04, nodes 1 and 2). About 40 minutes.

      Open the teacher guide: answers, solutions, slides and a worksheet.

      Students will be able to

      Before class

      Pilot (Oct 2026): the lesson opens with a real key (five common Australian birds, drawn as a Mermaid flowchart in a short first step) and Make comes back to test it with a bird it was not built for; "Also used in" closes it. The middle of the lesson is unchanged. This pilot tests a Mermaid opening, which decks and worksheets carry; the cost is one extra step pill. Tell us whether it helps.

      Do the Run board yourself first. Students need the triangle and quadrilateral classes (Classifying shapes lessons).

      The one idea: each shape must reach its own name, so the most specific question comes first. A short algorithm can be wrong; testing on one shape of every class finds it (Pia's mistake).

      The board follows the key one question at a time; it is the same tool students use for living things in science. Students design on paper: the Make stretch asks for an algorithm for triangles by angles, drawn as a flowchart or written as numbered steps.

      Judging two algorithms for efficiency (fewest questions) and for edge cases (the kite) are wider ideas.

      This links to Code: an algorithm written in steps is a program with if and else.

      Running the lesson

      1. Predict: ask what the machine should say for the equilateral triangle.
      2. Run: ask which triangle the algorithm gets wrong, and why.
      3. Investigate: ask what test shapes Pia should have used.
      4. Modify: ask students to describe the quad algorithm in words.
      5. Make: back to the bird key. Ask who can find a bird it gets wrong before anyone looks at the options; then ask what every key needs (a way to say 'not in this key'). Then books out: students draw their fixed key as a flowchart and follow a female superb fairy-wren through it, one box at a time, before they pick why she ends at 'not in this key'. Ask what the key should do with her.

      The hard part (on purpose)

      Ordering the questions. Ask students to say which shape each question separates before they put it in a position.

      When students get stuck

      Stretch and support

      Stretch: Compare two correct algorithms for the same job: which asks fewer questions on average? Then write the triangle algorithm in Python with `if` and `else`.

      Support: Give students the questions on cards and ask them to lay out the order before they use the board.

      Where it leads

      This completes AC9M7SP04.

      Where it leads: algorithms in code (the Code pathways), flowcharts for other decisions, and decision trees in Probability.

      Sources

      What each step is for