ScholaFly

CS10-01 Computer Science Watch

What an algorithm is

Watch on YouTube

In this lesson

What an algorithm is: how to define an algorithm as a sequence of steps that can be followed to complete a task - using the word SEQUENCE, not 'set'. AQA 8525 GCSE. Algorithms 1 of 9. More at https://scholafly.com

By the end: Define an algorithm as a sequence of steps that can be followed to complete a task - using the word SEQUENCE, not 'set' - and explain that a computer program is an implementation of an algorithm, not the algorithm itself.

What it covers

  1. 0:00 Intro: what an algorithm is
  2. 0:34 What an algorithm is: the definition
  3. 3:19 What an algorithm is: set or sequence
  4. 5:02 Algorithm or program
  5. 7:11 Two slips in one sentence

Key words

About this video

What an algorithm is | GCSE Computer Science | CS10-01

What an algorithm is: how to define an algorithm as a sequence of steps that can be followed to complete a task - using the word SEQUENCE, not 'set'.
AQA 8525 GCSE. Algorithms 1 of 9.
More at https://scholafly.com

Video code: CS10-01 (search "ScholaFly CS10-01")

#GCSEComputerScience #Algorithms #WhatAnAlgorithmIs

For teachers
This GCSE Computer Science lesson teaches what an algorithm is. By the end, students should be able to define an algorithm as a sequence of steps that can be followed to complete a task - using the word SEQUENCE, not 'set' - and explain that a computer program is an implementation of an algorithm, not the algorithm itself. It works through four worked examples and the mistakes examiners report.

Exam board specification references:
AQA 8525
- 3.1.1

Read the transcript

A chef, you at home, and a factory robot all make pancakes from one recipe. Which one is the algorithm? The robot is tempting, because it runs a program. But a program is not quite an algorithm, and the definition says why. And shuffle the recipe's steps, and the pancakes fail: a clue to the one word the definition cannot do without.

An algorithm is a sequence of steps that can be followed to complete a task. Every part of that sentence is doing a job. A sequence is a list in a fixed order, where first, second and third matter. Can be followed means someone or something carries the steps out, one at a time. And complete a task means the steps finish a job. One course prints this definition word for word. Every course uses the word algorithm all the time, so the sentence is worth having whichever course you sit. Here are five steps for a cup of tea, out of order. A, pour in the milk. B, pour the boiling water into the cup. C, put a tea bag in the cup. D, boil the kettle. E, take the tea bag out. Put the five tea steps, A to E, into an order that works. D first, then C, then B, then E, and A goes last. In the muddled order, milk goes into an empty cup, and then the cup is filled from a cold kettle. Same five steps, and the tea is ruined. Now, why are those five steps, in another order, not the same algorithm? Because an algorithm is a sequence. The order is part of the instructions, so a new order is a new algorithm, and this one ruins the tea. If that sentence is already familiar, you are in good company. One examiner's report says: "The definition of an algorithm was well answered." Later in the same paragraph it adds: "Over seventy-five per cent of students were awarded both marks for this question but nearly ten per cent did not gain any of the available marks." The habit that keeps you in the first group is precise wording, and it starts with one word in that definition.

Sequence has a looser neighbour, the word set. A set of steps is a collection of steps with no order at all. Shuffle a set and nothing has gone wrong, because a set has no order to break. Shuffle a sequence and the tea is ruined, because the order was part of it. A shopping list, or directions to a friend's house: which one is a sequence? The directions. Take the turns in a different order and you end up somewhere else. A shopping list works in any order, so it is closer to a set. One examiner's report puts the slip like this: "Centres should note however, that the definition given in the specification uses the term 'sequence of instructions', whereas a lot of students are using the term 'set of instructions' which is not specific enough as it does not imply a specific sequence. Although credited at GCSE, it is unlikely to be at A-level so teachers should encourage the use of the correct definition from the specification." So set is still credited at GCSE, but it does not say the steps have an order. The fix is one word: write sequence, every time, and the order is built into your answer.

A computer program is an implementation of an algorithm. Implementation means one way of carrying the plan out, written in a programming language so a computer can run it. The algorithm is the plan. The program is one way of carrying that plan out on a computer, and the plan can exist with no computer anywhere. Take an algorithm for the average of three numbers: add the three numbers together, then divide the total by three. A person with a calculator follows those steps by hand. A programmer also writes them in Python, and a computer runs that. How many algorithms is that, and how many programs? One algorithm and one program. Someone working it out on paper is still carrying out that same plan, and no code exists for them. An algorithm does not have to be written as code to count. It can be written in plain English, drawn as a diagram, or typed as code, and it is the same algorithm each time. The two ways exams write algorithms down get their own videos, Flowcharts and Pseudocode. A report on the same question records the other slip: "A common error was to confuse an algorithm with a program and state that a computer would execute the algorithm which is not always the case." The fix is to keep the two words apart. A computer runs a program. The algorithm is the plan, and a person can follow it with no computer at all, like the chef with the pancakes.

One student's sentence makes both slips at once, so it is worth taking apart. An algorithm is a set of instructions that a computer executes. What are its two slips? Set should be sequence, because order matters. And a computer executes describes a program, because an algorithm can be followed with no computer at all. Now write two sentences of your own. The first defines an algorithm. The second says what makes an algorithm different from a computer program. Write both sentences, algorithm then computer program, before I show you a model. Sentence one is the definition, with sequence in it. Sentence two: a program is one implementation of an algorithm, written in a programming language for a computer, while the algorithm is the plan itself. Neither sentence mentions pancakes. A recipe is an example of an algorithm. A definition says what kind of thing something is, and an example only points at one.

Both sentences get put to work now, one question at a time. What is the definition of an algorithm, in one sentence? A sequence of steps that can be followed to complete a task. Try this: a phone app gives turn-by-turn directions. Is the app an algorithm, or a program? A program. It is one way of carrying out a plan on a phone, and that plan could be written on paper and followed on foot. Another one: two morning routines with the same steps in different orders. Same algorithm? No. An algorithm is a sequence, so a new order makes a new algorithm. One more: the pancake recipe, the chef and the robot. Which of them is the algorithm? The recipe. The chef follows it by hand, and the robot runs a program that carries out the same plan.

The chapter list now carries a thumbs up beside this video. Anyone who could teach this one to a friend can give it a thumbs up and skip it next time round. Not there yet is fine: save it for later, then write both sentences out by hand once, because writing them is what fixes them in place.

Next in the chapter: Decomposition and abstraction, two ways to make a big problem manageable. Hopefully that's next in your feed, but if not, search for ScholaFly C S ten, oh two.

Every other video is on scholafly.com too, easy to search by video code or by keyword. Whatever you're revising, go there and have a look, or, watch the next video.

Related terms

For: AQA GCSE 8525

On the specification

BoardSpecStatement
AQA GCSE 85253.1.1Representing algorithms
For teachers

This GCSE Computer Science lesson teaches what an algorithm is. By the end, students should be able to define an algorithm as a sequence of steps that can be followed to complete a task - using the word SEQUENCE, not 'set' - and explain that a computer program is an implementation of an algorithm, not the algorithm itself. It works through four worked examples and the mistakes examiners report.