What is an algorithm?

Open navigator

1. Algorithms

An algorithm is a sequence of instructions or a set of rules that are followed to complete a task. This task can be anything, so long as you can give clear instructions for it.

For example, to make yourself a drink you have to follow a sequence of steps in the right order. If you do something in the wrong order you might end up making a mess.

2. Clear instructions

When you write an algorithm you need to include precise, step-by-step instructions.

Here are the instructions for making a smoothie:

1. Add fruit to the blender.

2. Add milk to the blender.

3. Put the lid on the blender.

4. Switch the blender on.

Imagine if we missed out one of the steps or reversed the order. We could end up switching on the blender with nothing in it. Or there could just be milk in the blender and no fruit.

That wouldn't make a very tasty smoothie, would it? In fact, it wouldn't make a smoothie at all!

3. Speaking a computer's language

Computers won’t understand your algorithm as they use a different language.

It will need to be translated into code which the computer will then follow to complete a task.

This code is written in a programming language. There are many different types of programming languages.

Some that you may come across are Logo, Scratch, Blockly, Python and Kodu. Each of these languages are suited to different things.

4. Algorithm experiment

In this video Nate follows an algorithm he has written to carry out a science experiment.

Nate follows an algorithm to safely make a fireball. Don't try this at home.

5. Car park algorithm

A flow chart showing an algorithm for a car park with a set number of spaces and automatic barriers.

Take a look at the sequence of instructions shown in the flow chart. Can you see what is happening in this algorithm and explain how it works?