Designing, creating and refining algorithms
Inputs, processes and outputs
Before writing a solution, identify its inputs, the processes performed on them and the outputs the user needs.
Example: calculate a class average
- Input: each student's mark.
- Process: add the marks and divide by the number of students.
- Output: the average mark.
A structure diagram can show how a main task is broken into smaller tasks:
- Calculate class average
- Get marks — read each mark
- Calculate total — add the marks
- Calculate average — divide total by count
- Display average — show the result
Key terms
Flowchart symbols
A flowchart shows an algorithm with standard shapes and arrows. The shape helps identify what each step does:
| Symbol | Shape | Use |
|---|---|---|
| Terminal | Rounded oval | Start or end |
| Process | Rectangle | Calculation or assignment |
| Decision | Diamond | A condition with two labelled routes, often Yes and No |
| Input/output | Parallelogram | Read input or display output |
| Sub-program | Rectangle with double sides | Call a named sub-program |
This chart asks for a mark and displays whether it passes. Follow the arrows in order; the decision's labels tell you which branch to take.
Key terms
Pseudocode, tracing and refining
Pseudocode describes an algorithm in structured, readable steps without requiring every programming-language detail. OCR Exam Reference Language (ERL) has precise syntax; Python is a high-level language. The same logic can be expressed in either:
INPUT mark
IF mark >= 50 THEN
OUTPUT "Pass"
ELSE
OUTPUT "Try again"
ENDIF
A trace table records how variables change at each step. Use it to find a logic error, complete an unfinished algorithm or check a refinement. For input 62, the condition mark >= 50 is true and the output is Pass. Test a different input, such as 40, to check the other branch.