Computational Thinking · Cambridge syllabus 7.1, 7.2, 7.3 · Lesson 3 of 4
Algorithmic Thinking
Algorithmic thinking turns a requirement into precise ordered steps. Identify the inputs, processes, outputs and storage, then decide where choices and repetition are needed. A correct algorithm must handle the required range of inputs and stop. Reading an algorithm the other way, you should be able to state its purpose and describe what each part does.
By the end, you can
- Develop logical step-by-step solutions.
- Identify the inputs, processes, outputs and storage of a problem.
- Recognise repeated patterns.
- Design algorithms that solve defined problems.
- State the purpose of a given algorithm and describe its processes.
Step-by-step solutions
An algorithm is a finite sequence of precise steps that solves a problem. Precise means that each step can be followed without judgement, and finite means it always finishes.
Algorithmic thinking is working out those steps in a sensible order. The reliable way to start is to identify the inputs, the processes, the outputs and the storage: what data comes in, what must be done to it, what must come out, and what has to be kept, in variables, arrays or files. Once those are written down, the middle is usually a short list of steps.
Take calculating an average mark. Input: how many marks, and then the marks themselves. Processing: add each mark to a running total, then divide the total by the count. Output: the average. The order matters and cannot be rearranged — the total must be zero before anything is added to it, and the division must come after every mark has been added.
Spotting repetition is the other half. Any step described as and then again for the next one is a loop: instead of writing add mark 1, add mark 2, add mark 3, write repeat for each mark, add it to the total. Any step that happens only under a condition is selection. Nearly every algorithm is sequence, selection and iteration arranged around a few variables.
Test the algorithm by walking through it with real values before writing any code. Most logic errors are visible on paper in two minutes, and invisible in code for an hour.
The skill also runs the other way: given an algorithm, explain its purpose. State what it is for in one sentence, such as it finds the highest mark entered, then describe its processes: what it inputs, what each loop and condition does, and what it outputs. Tracing it with a few values first is the quickest way to see what it does.
Worth remembering
- An algorithm is a finite sequence of precise, unambiguous steps.
- Start by identifying the inputs, processes, outputs and storage.
- Repetition becomes a loop; a conditional step becomes selection.
- Given an algorithm, state its purpose and then describe its processes.
Worked example
To find the largest value, initialise from the first item, compare each remaining item and replace the stored maximum when a larger value is found.
Practice
Warm-up · not marked
Check your understanding
Answer in your own words, then compare with the worked answer. Nothing here is saved or scored.
Worked answer
Zero may be larger than every list item even though it is not in the list; initialise from an actual item instead.
Check your method, units and explanation against it.
Marked practice
Set 1 of 5 · easiest first · Checked as you go, with the worked answer. Sign in or create a free account to save your progress.