topic badge
CanadaON
Grade 8

11.02 Following algorithms

Lesson

Image by Mateyko Thiessen

An algorithm (pronounced al-go-ri-them) is a step by step guide on how to do something.

We use them all the time, although you probably didn't realise. Ever followed a recipe? That is an algorithm.

Do you know how to use the column addition method? Then you have learned and applied an algorithm.

It is important that the steps are clear. This is why if you follow a recipe they often split it up into parts, so it is easy to see what to do and in which order.

Algorithms are used in computing too. It is even more important to be clear when writing instructions for a computer as they cannot guess what you mean. When we give instructions to computers we need to write code or use a flow chart. There are lots of different types of code (they are called languages) but they work in the same ways. 

 

Remember!

For an algorithm you need to make sure each step is clear

You also have to make sure you give the correct order

Try it yourself

Look at the following algorithm. Try to work out what it is for.

  1. boil kettle
  2. put teabag into tea cup
  3. add milk
  4. put water into kettle
  5. take out teabag
  6. stir with a spoon
  7. add one teaspoon of sugar

Could you guess this was supposed to be the instructions for how to make a cup of tea? What was wrong with the algorithm? What do you need to do to improve it? 

Now try writing a short algorithm for yourself. Imagine you are giving your algorithm instructions to a robot. Would the robot know what to do?

You could try writing an algorithm to explain how to:

  • walk from your school to the nearest park
  • make a snow angel
  • pat a dog
  • grow a sunflower

 

Worked Examples

Question 1

Choose all the tasks below that can be completed by following an algorithm.

  1. Falling asleep

    A

    Falling in love

    B

    Cooking a meal from a recipe book

    C

    Building a toy out of Lego

    D

 

Question 2

Follow this algorithm.

  1. Start with the number $16$16.

    Add $5$5 to $16$16.

  2. Double your answer to part a.

 

Question 3

Follow this algorithm and work out the output at each step.

  1.   Output
    Step 1: Start with $80$80 $\editable{}$
    Step 2: Add $19$19 to $80$80 $\editable{}$
    Step 3: Round the result to the nearest ten. $\editable{}$

Outcomes

8.C3.1

Solve problems and create computational representations of mathematical situations by writing and executing code, including code that involves the analysis of data in order to inform and communicate decisions.

8.C3.2

Read and alter existing code involving the analysis of data in order to inform and communicate decisions, and describe how changes to the code affect the outcomes and the efficiency of the code.

What is Mathspace

About Mathspace