From a problem to an algorithm
About this lesson: From a problem to an algorithm
In short
Before writing any code, work out the inputs (data going in), the process (what happens to it) and the outputs (results). Explore a cinema ticket machine.

What you'll explore
- Inputs, process, outputs: What goes in, what comes out?
- Before writing any code, work out the inputs (data going in), the process (what happens to it) and the outputs (results).
- Decomposition: Break the problem down
- Big problems are easier when you split them into smaller sub-problems, then split those again.
- Flowchart symbols: Four shapes
- A flowchart shows an algorithm as shapes joined by arrows. Each shape has a job: start and stop, input and output, process, and decision.
- Flowcharts: Follow the arrows
- This flowchart sets a ticket price: children under 12 pay $2, people 65 and over pay $1, others $3. Change the age and follow the highlighted route.
- Pseudocode: The same algorithm in words
- Pseudocode writes an algorithm in structured English that any programmer can turn into code.
- Check yourself: Pick the symbol
- In a login flowchart, the next step asks: 'Is the password correct?'
Also in this lesson
- From problem to pseudocode
- Watch out for these
- Writing pseudocode in tests
- The three building blocks
- More than the lesson
- Stretch your brain
- Algorithms in daily life
Words to know
- algorithm
- A set of step-by-step instructions to solve a problem.
- decomposition
- Breaking a problem into smaller sub-problems.
- abstraction
- Hiding details that are not needed.
- flowchart
- A diagram of an algorithm using shapes and arrows.
- pseudocode
- Structured English for writing algorithms.
- terminator
- The rounded Start/Stop symbol.
- process
- A step that does something, drawn as a rectangle.
- decision
- A Yes/No question, drawn as a diamond.
- sequence
- Steps carried out in order.
- selection
- Choosing between paths.
- iteration
- Repeating steps.
Sources
- BBC Bitesize, GCSE Computer Science: Algorithms, decomposition and abstraction
- MacTutor History of Mathematics: al-Khwarizmi
- Isaac Computer Science: Flowcharts and pseudocode
- Python documentation: control flow tools
← File size and compression · Loops: counting and totalling →