What is an algorithm?
An algorithm is a set of step-by-step instructions used to solve a problem. They are used by both human beings and computers.
Algorithms for Humans
Common examples of algorithms for humans include:
Algorithms for Computers
Computers require algorithms to function and these usually come in the form of software. Computers differ from humans in that the instructions provided must completely unambiguous – they must be clear and not open to interpretation.
Computer Algorithms used in computers are usually written in text or block based programming languages such as Python or Scratch, though some algorithms are physically wired into a computer.
Video – What is an algorithm?
Activity 1 – Making a cup of tea algorithm
Can you write an algorithm for making a cup tea?
- What type of tea?
- Do they want sugar? If so how many teaspoons?
- How long do you leave the tea bag in for?
- What about milk? How much?
- When should you put the milk in?
- What about making a cup of tea for more than one person?
Activity 2 – Alien shopping algorithm
An alien has landed on earth and you have decided to send him on an important mission – to do your weekly shopping down at the supermarket! You have been given a shopping list. The alien has never been shopping before – can you write a set of instructions for it to do the shopping for you?
Your algorithm must be:
- Unambiguous – Each step must be completely clear and specific.