The Grade 12 consolidation content — searching, sorting, two-dimensional arrays and recursion — plus the efficiency arguments the memo expects you to be able to make.
| Algorithm | How it works | Requires |
|---|---|---|
| Linear search | Check each element in turn; stop when found | Nothing |
| Binary search | Halve the range each step | A SORTED array |
| Bubble sort | Swap adjacent out-of-order pairs, repeatedly | Nothing |
| Selection sort | Find the max/min of the rest, swap it into place | Nothing |
Binary search is dramatically faster than linear search, but only because the array is sorted — say so when asked to justify it. Selection sort does at most one swap per pass; bubble sort may do many.
Example
// Two-dimensional array: rows = learners, columns = subjects var marks: array[1..3, 1..4] of Integer; r, c, total: Integer; begin for r := 1 to 3 do begin total := 0; for c := 1 to 4 do total := total + marks[r, c]; WriteLn('Learner ', r, ' average: ', (total / 4):0:1); end; end.
The outer loop picks the row, the inner loop walks that row's columns. Swapping them gives you column totals instead — read the question carefully to see which is wanted.
💡 Exam Tip
In a for-loop the counter is read-only inside the loop body — assigning to i is a compile error, and a favourite exam trap.