Easier to read with cream paper, a tint, more contrast or larger text? Choose your colours and text, once, for every page.

Free lesson

1.2 (1 of 3): Algorithms and flowcharts

The whole lesson, free. Read it and have a go at the activities. To work the tasks and labs in the real lesson, press Start lab, with no account needed.

45 minutes

A quick check that you are not a bot, then your own lab opens on the interactive lesson.

Already have an account? Sign in

A recipe is a program for people

You follow steps to make a cup of tea. Boil the water. Put a tea bag in a cup. Pour the water. Wait. Take the bag out.

If you change the order, the tea goes wrong. A list of steps in the right order is an algorithm: a list of clear steps that solves a problem.

Key words

WordWhat it meansExample
AlgorithmA list of clear steps in order that solves a problem.a recipe
FlowchartA picture of an algorithm made of shapes and arrows.start, check age, end
TerminatorThe shape for Start and End.a rounded box
ProcessThe shape for one thing to do.add 1 to the score
Sub-processThe shape for a job that has its own flowchart.check the password
DecisionThe shape for a question with two answers.is it raining?
SequenceSteps one after another, in order.wake up, wash, eat
SelectionChoosing a path by asking a question.if it rains, take an umbrella
IterationRepeating steps.knock until the door opens
LoopAnother name for iteration.repeat until the door opens

The cells students fill in are left blank in this preview.

Is it an algorithm?

Have a go

Is it an algorithm?

3 questions
Have a go: your answers are marked here and then forgotten. Sign in if you would like your score kept, and to pick up where you left off.Sign in to keep your score

What makes a good algorithm

It is...This means...Example
ClearEach step has only one meaning."Add 2" not "add a bit"
In orderThe steps are in the right order.Boil the water before you pour it
FiniteIt ends after a fixed number of steps.It does not run for ever
Has inputs and outputsIt takes in data and gives a result.In: age. Out: ticket price
CorrectIt solves the whole problem.It works for a child and an adult

The cells students fill in are left blank in this preview.

Why write an algorithm first?

A computer cannot guess. It does exactly what the steps say. Nothing more.

If you write the algorithm first, you find mistakes before you write code. You can also show the plan to other people.

The flowchart shapes

A flowchart naming each shape: Terminator: Start, then Input or output: Read the weather, then Decision: Is it raining?, where yes goes to Process: Take an umbrella and no goes to Sub-process: Check the sun cream; both go to the connector A, then Terminator: End.A flowchart naming each shape: Terminator: Start, then Input or output: Read the weather, then Decision: Is it raining?, where yes goes to Process: Take an umbrella and no goes to Sub-process: Check the sun cream; both go to the connector A, then Terminator: End.

Match the shape to its job

Have a go

Loading…

Your answers are marked here and are not kept. A college account keeps every student’s marks.

Arrows show the order

Arrows show the order. Follow them from Start to End.

A decision has two arrows out. Each arrow has a label, such as yes or no. The circle with a letter is a connector. It joins two parts of a chart that are far from each other.

Read a flowchart: a bus pass

A flowchart: Start, then Input: pass type, then the question Is it a student pass?, where yes goes to Fare is 1 pound and no goes to Fare is 2 pounds; both go to Output: the fare, then End.A flowchart: Start, then Input: pass type, then the question Is it a student pass?, where yes goes to Fare is 1 pound and no goes to Fare is 2 pounds; both go to Output: the fare, then End.

Your turn: draw a flowchart

A cinema checks if you can see a film. The film is for age 15 and over. Finish the flowchart. Use the right shape for each step.

  1. Add an input for the age.
  2. Add a decision: is the age 15 or more?
  3. Add an output for each answer: Welcome, or Sorry, too young.
flowchart TD
  s([Start]) --> todo[Put your steps here]
  todo --> e([End])

Make a free account to save your work, or press Start lab to work through the whole lesson.

Three ways to control the order

Every algorithm is built from three actions.

Sequence: do the steps one after another.

Selection: ask a question and choose a path.

Iteration: repeat steps until something is true.

Iteration: a loop in a flowchart

A flowchart: Start, then Set count to 0, then the question Is count 3?, where no goes to Output: Hello, then Add 1 to count and back to the question, and yes goes to End.A flowchart: Start, then Set count to 0, then the question Is count 3?, where no goes to Output: Hello, then Add 1 to count and back to the question, and yes goes to End.

Sequence, selection or iteration?

Have a go

Sequence, selection or iteration?

4 questions
Have a go: your answers are marked here and then forgotten. Sign in if you would like your score kept, and to pick up where you left off.Sign in to keep your score

Watch: algorithms and flowcharts

Press Play on the short film below. It goes from the tea steps to the flowchart shapes, builds the bus pass flowchart and follows one input through it, then shows a loop. Watch where a question has to go, and why each of its arrows has a label.

Film: algorithms and flowcharts

Algorithms and flowcharts

Every scene, as text

  1. An algorithm is a list of clear steps in order that solves a problem. To make a cup of tea: boil the water, put a tea bag in a cup, pour the water, wait, then take the bag out.
  2. A flowchart is a picture of an algorithm made of shapes and arrows. A rounded box, the terminator, is Start or End. A slanted box is an input or output. A diamond is a decision, a question with two answers. A rectangle is a process, one thing to do.
  3. A bus pass, read by following the arrows from Start to End: input the pass type, then the decision, is it a student pass? Yes, the fare is 1 pound; no, the fare is 2 pounds. Output the fare, then End. Each arrow out of a decision has a label.
  4. Trace one input, a student pass. Start, and the input is student. Is it a student pass? Yes, so the fare is 1 pound and the output is 1 pound. End.
  5. Sequence, selection and iteration control the order. Iteration repeats steps until something is true: set count to 0; is count 3? No, so output Hello, add 1 to count and go back to the question. After three Hellos count is 3, so yes: End.
  6. Myth (false): a question goes in a rectangle. A rectangle is one thing to do, and its two arrows out say nothing. A question is a decision, so it goes in a diamond, and each arrow out has a label, yes or no.

Good and bad points of flowcharts

Good pointsBad points
You can see the whole path quickly.A big chart is slow to draw and hard to change.
Good for people who do not code.Too many arrows become confusing.
Decisions and loops are clear.It does not show the exact details a computer needs.
Mistakes in the logic are easy to spot.Not every program fits on one page.

The cells students fill in are left blank in this preview.

Key words crossword

Have a go

Loading…

Your answers are marked here and are not kept. A college account keeps every student’s marks.

Exit quiz

Have a go

Exit quiz

6 questions
Have a go: your answers are marked here and then forgotten. Sign in if you would like your score kept, and to pick up where you left off.Sign in to keep your score

Remember

Important

An algorithm is clear steps in order. A flowchart draws it with six shapes and arrows. Sequence, selection and iteration control the order.

Teach this lesson with your class

On a college account your students work the tasks and the labs as well, and every mark is kept for you.