3 – Algorithms

🎯 Learning Objectives

Develop the Algorithms Learning Strand:

  • Understand what an algorithm is.
  • Understand that when computer programs produce unexpected outputs they could be due to bugs in programming code.
  • Create a simple flow chart using input, output, process and decisions.
💬 Key Vocabulary

  • Algorithm
  • Input
  • Process
  • Output
  • Decision
  • Bug

📝 Starter Activity – Algorithms

  • An algorithm is a series of step by steps instructions which solve a problem.
  • We follow algorithms everyday, for example when making a cup of tea.
  1. Get a cup
  2. Get a teabag
  3. Get the milk out of the fridge
  4. Get the sugar
  5. Put water in the kettle
  6. Turn on the kettle
  7. Put the teabag in the cup
  8. Put the boiling water from the kettle into the cup
  9. Wait for a minute
  10. Take the teabag out of the cup
  11. Put a dash of milk into the cup
  12. Put a teaspoon of sugar into the cup
  13. DRINK!
  • Write down the steps to other algorithm that you follow.

📖 Flowcharts

  • A flowchart is a type of diagram that represents an algorithm, workflow or process, showing the steps as boxes of various kinds, and their order by connecting them with arrows.
  • Each shape represent some steps in the algorithm:
  • The following is a simple example of using flowchart to show the steps in a calculator:

🥈 Silver – Flowcharts

  • Use the symbols above to design a flow chart which shows the algorithm for a task that you regularly perform.
  • Download the worksheet below to do this.

📖 Bugs

  • A bug is an error in a computer program.
  • Sometimes a bug may cause a computer program to stop running altogether, this is called a syntax error.
  • At other times a bug may cause an unexpected output to be given by a system, for example:
    • If we asked a computer program to carry out the calculation 5 + 4 and it output 10 this would show us that there was a bug in our program. This kind of error is called a logic error.
  • It is important to test programs to try to remove any bugs before we start to use it.
  • One method of reducing the number of bugs in our program is to plan out the processes before we start to write our actual program. One way of doing this is to use a flow chart.

🥇 Gold – Find the Bugs

  • The algorithms in the worksheet below each contain a bug which makes them produce unexpected outputs. These are known as logic errors. Can you identify the bugs and suggest a way that they could be fixed?
  • Download the worksheet below to do this.

🥉 Platinum – Design a Flowchart

  • This activity has been created to allow you to practise designing your own flowchart. Below are the instructions for a mind-reading maths trick, which can be carried out in the non-digital world or by a computer. You must decide on the correct sequence for this maths trick, and think about any variables, inputs, and outputs that you might need.

In this lesson, you…

  • Looked at flowcharts and how to create and interpret them.
  • Found and fixed bugs in code.

Next lesson, you will…

  • See how to create binary numbers using the micro:bit.
  • Use LEDs to create output.

🏅 Badge it

🥈 Silver Badge

🥇 Gold Badge

🥉 Platinum Badge