The Cambridge syllabus expects the following four stages for every programming task.
| Syllabus block | Relevance to algorithm design |
|---|---|
| Data representation | Choosing the correct numeric type (binary, two’s‑complement, floating‑point) influences input validation and memory usage. |
| Data transmission | If the algorithm processes data received from a network or USB, students must understand packets, simplex/half‑duplex, and error‑checking. |
| Hardware | CPU cycles, cache, and instruction set affect the efficiency discussion (time/space complexity). |
| Software | System software (OS, interrupts) and application software determine where the algorithm will run and any platform‑specific constraints. |
| Aspect | Description |
|---|---|
| Problem statement | Given a finite list of numbers, locate the greatest (maximum) number. |
| Input | An integer n ≥ 1 followed by n numeric elements L[1..n]. |
| Output | The single value max such that max ≥ L[i] for every i = 1..n. |
┌─────────────────────────────┐ │ Maximum‑value problem │ ├─────────────────────────────┤ │ 1. Input handling │ │ 2. Initialise max │ │ 3. Comparison loop │ │ 4. Output result │ └─────────────────────────────┘
| Method | Typical use‑case | Example in these notes |
|---|---|---|
| Search (linear) | Find a particular item or an extreme value. | Maximum‑value algorithm. |
| Sort | Arrange data in a defined order. | Bubble sort – not shown. |
| Totalling | Calculate the sum of a series. | Summing exam scores – separate example. |
| Counting | Determine how many items satisfy a condition. | Counting occurrences of the maximum. |
| Minimum/Maximum | Locate the smallest or largest element. | Current algorithm (maximum). |
| Average | Compute the mean value. | Average of marks – separate example. |
| Step | Action |
|---|---|
| 1 | Read integer n and the list L[1..n]. |
| 2 | Validate input:
|
| 3 | Set max ← L[1] (first element becomes provisional maximum). |
| 4 | FOR i ← 2 TO n DO
|
| 5 | OUTPUT max as the largest value. |
IF n < 1 THEN
PRINT "Error: list must contain at least one element"
STOP
END IF
FOR i ← 1 TO n DO
IF NOT IS_NUMERIC(L[i]) THEN
PRINT "Error: element", i, "is not a number"
STOP
END IF
END FOR
The algorithm determines the maximum (largest) element in a finite collection of numeric data. This is a fundamental “search” operation used in many real‑world contexts, for example:
max holds the greatest value among the first element (L[1]).max, max is updated.max remains unchanged.L[i] (for i = 1..n) has been compared with max. Therefore max is the overall greatest value.O(n).max, i, n) → O(1).O(n) is optimal because any algorithm must look at every element at least once to guarantee correctness.Students should produce a trace table for at least two test cases – a normal case and an edge case (list length 1).
| Test case | Input (n, L) |
Step | i | L[i] | max (after step) |
|---|---|---|---|---|---|
| A (normal) | n = 5 L = [7, 3, 9, 2, 9] |
Initialise | – | – | 7 |
| Loop | 2 | 3 | 7 | ||
| Loop | 3 | 9 | 9 | ||
| Loop | 4 | 2 | 9 | ||
| Loop | 5 | 9 | 9 | ||
| B (edge) | n = 1 L = [‑4] |
Initialise | – | – | ‑4 |
| Loop | – (none) | – | ‑4 |
If the final max does not match the expected result, the trace will show where the logic failed.
> with <.pos that records the index whenever max is updated.max, make a second pass to count how many times L[i] = max.min and max in a single loop.
| Concept | Key points for exams |
|---|---|
| Binary ↔ Decimal | 2ⁿ values, weight of each bit, e.g. 1011₂ = 11₁₀. |
| Hexadecimal | Group binary in 4‑bit blocks; 0‑9, A‑F. Example: 0x3F = 63₁₀. |
| Two’s‑complement | Negative numbers: invert bits + 1. Range for 8‑bit: –128 to +127. |
| Logical shift | Left shift = multiply by 2; right shift = integer division by 2 (discard remainder). |
| Aspect | Typical exam question |
|---|---|
| Packet structure | Identify header, payload, and trailer; calculate total bits. |
| USB vs Serial vs Parallel | Choose the most suitable method for a given data‑rate and distance. |
| Duplex modes | Explain why a full‑duplex link is required for simultaneous video & audio streaming. |
| Component | Exam‑relevant facts |
|---|---|
| CPU (FDE cycle) | Fetch → Decode → Execute. Clock speed determines how many cycles per second. |
| Core & cache | More cores → parallelism; cache reduces memory‑access time. |
| Instruction set | RISC (few simple instructions) vs CISC (many complex instructions). |
| Embedded system | Dedicated hardware + software for a specific task (e.g., microwave controller). |
| Category | Key points |
|---|---|
| System software | Operating system, device drivers, utilities; manages resources and provides interrupts. |
| Application software | Programs that solve user‑focused problems – e.g., a spreadsheet that uses the maximum‑value algorithm. |
| Programming languages | High‑level (Python, Java) vs low‑level (Assembly). Cambridge expects pseudocode/flowchart, not language‑specific syntax. |
O() notation).Following this structure will satisfy the Cambridge IGCSE/AL assessment objectives (AO1–AO3) for algorithm design and problem solving.
Create an account or Login to take a Quiz
Log in to suggest improvements to this note.
Your generous donation helps us continue providing free Cambridge IGCSE & A-Level resources, past papers, syllabus notes, revision questions, and high-quality online tutoring to students across Kenya.