LEARNING OBJECTIVES
What you will be able to do
- decompose problems into inputs, processes and outputs
- write and trace pseudocode and flowcharts
- apply validation, verification and test data
- use standard searching, sorting, counting and totalling algorithms
AT A GLANCE
INTRODUCTION · THE BIG IDEA
Develop, represent, test and improve precise solutions to computational problems.
An algorithm is a finite, ordered solution independent of a particular programming language. Good design begins by understanding the problem and decomposing it into manageable modules.
Tracing and systematic test data expose faults before implementation becomes expensive.
SECTION 01
Problem analysis and decomposition
State inputs, required outputs, processing, constraints and success criteria. Abstraction removes irrelevant detail, while decomposition creates modules with clear responsibilities and interfaces.
A structure diagram shows module hierarchy. Each module should have a clear purpose, parameters and result so teams can develop and test parts independently.
SECTION 02
Pseudocode, flowcharts and tracing
Pseudocode expresses sequence, selection and iteration using consistent keywords and indentation. Flowcharts use standard start/end, process, input/output and decision symbols with directed flow lines.
A trace table records variable values and outputs after each relevant statement or loop pass. Dry-running checks logic without execution and helps reveal off-by-one errors, wrong conditions and uninitialised totals.
SECTION 03
Validation, verification and test data
Validation checks may include range, length, type, format, presence and check digit. Verification checks copying accuracy through double entry or visual comparison.
Normal test data lies within expected range, abnormal or erroneous data should be rejected, boundary data lies at accepted limits and extreme data is the largest or smallest valid value. A test plan states data, type, expected result, actual result and pass/fail outcome.
| Data type | Purpose |
|---|---|
| Normal | confirm ordinary valid input |
| Boundary | test exact limits and just outside |
| Abnormal | confirm invalid input is rejected |
| Extreme | test largest or smallest valid value |
SECTION 04
Standard algorithms
Linear search examines items until a match or the end. Bubble sort repeatedly compares adjacent items and swaps those out of order until a pass makes no swaps.
Counting increases a counter when a condition is met; totalling adds values to an accumulator; finding maximum or minimum starts from the first item and updates when a more extreme value appears. These patterns can be combined with arrays and loops.
Trace one bubble-sort pass
- Start [7, 3, 5, 2].
- Compare 7 and 3: swap → [3, 7, 5, 2].
- Compare 7 and 5: swap → [3, 5, 7, 2].
- Compare 7 and 2: swap → [3, 5, 2, 7].
Answer: After the first pass, the largest value 7 is in its final position.
QUICK CHAPTER SUMMARY
The ideas to carry forward
- Analyse before representing or coding a solution.
- Pseudocode and flowcharts must be unambiguous.
- Test plans cover valid limits and invalid cases.
- Standard patterns reduce algorithm errors.
QUICK REVISION CHECKLIST
Can you do each of these without your notes?
- decompose problems into inputs, processes and outputs
- write and trace pseudocode and flowcharts
- apply validation, verification and test data
- use standard searching, sorting, counting and totalling algorithms