Computer Science · Ch 4 — Introduction to Problem Solving
Representation of Algorithms
4.4
Representation of Algorithms
Software designers and programmers use their algorithmic thinking skills to analyse a problem and identify the logical steps that must be followed to reach a solution. Once those steps are identified, they need to be written down together with the required input and the desired output — and for that, a standard way of representing the algorithm is needed.
Two common representations
There are two widely used methods of representing an algorithm:
- Flowchart — a visual, diagrammatic representation (section 4.4.1), and
- Pseudocode — a structured, human-readable textual representation (section 4.4.2).
Either method may be used, provided the representation:
- showcases the logic of the problem solution, leaving out any implementational details (nothing about a particular programming language belongs here), and
- clearly reveals the flow of control during the execution of the program — the order in which steps happen, where the path branches and where it repeats.
Standard flowchart symbols (Table 4.1)
Flowcharts are drawn from a small vocabulary of standardised shapes, each with a fixed meaning:
| Symbol | Name / function | Description |
|---|---|---|
| Oval | Start/End | Also called the "Terminator" symbol. It marks where the flow starts and where it ends. |
| Rectangle | Process | Also called the "Action Symbol". It represents a process, an action, or a single step. |
| Diamond | Decision | A decision or branching point. Usually a yes/no or true/false question is asked, and based on the answer the path splits into two branches. |