← Back to subjects
0
Cambridge IGCSE Computer Science (0478) · Algorithm design and problem-solving
Mini-Lesson

Algorithm design & problem-solving

An algorithm is a set of ordered steps that solves a problem. This mini-lesson covers computational thinking (decomposition & abstraction), flowcharts & pseudocode, linear & binary search, bubble & insertion sort, trace tables, and validation vs verification.

problem algorithm (ordered steps) solution

Work through each screen, answer the questions, and collect ⭐ stars. Press Start when ready.

Computational thinking

Decomposition & abstraction

  • Decomposition — breaking a large, complex problem into smaller, manageable sub-problems that are easier to solve.
  • Abstractionremoving unnecessary detail and keeping only the information needed to solve the problem (e.g. a map shows roads, not every building).
  • Pattern spotting — recognising similarities so solutions can be reused.
Sort it

Which skill is it?

Tap a statement, then tap the group it belongs to.

🧱 Decomposition

🔍 Abstraction

➡️ Sequence

Flowcharts & pseudocode

Flowcharts & pseudocode

Algorithms can be written two ways:

  • Flowchart — boxes and arrows. Common symbols: terminator (start/stop, rounded), process (rectangle), decision (diamond, yes/no), input/output (parallelogram).
  • Pseudocode — structured English-like statements (INPUT, OUTPUT, IF…THEN…ELSE, FOR, WHILE).
age ≥ 18? Yes OUTPUT "adult" No → OUTPUT "minor"
A decision (diamond) splits the flow into Yes / No paths.
Searching algorithms

Linear & binary search

  • Linear search — check each item in turn from the start until the target is found or the list ends. Works on any list; slow for large lists.
  • Binary search — only works on a sorted list. Check the middle item; if it is the target, stop; if the target is smaller, search the left half, otherwise the right half. Repeat, halving the list each time — much faster.
Worked example — binary search for 29 in [3, 7, 11, 18, 23, 29, 35]

Middle is index 3 = 18. 29 > 18, so search the right half [23, 29, 35].

Middle of that is 29 — found in just 2 comparisons.

Calculate

Your turn — binary search

1Using binary search on the sorted list [3, 7, 11, 18, 23, 29, 35], the first item examined is the middle one. Which value is checked first?
Hint: there are 7 items (indexes 0–6). The middle index is (0+6)÷2 = 3.
Quick check

Which search?

?A list is not sorted. Which searching algorithm can still be used to find an item?
Sorting algorithms

Bubble & insertion sort

  • Bubble sort — repeatedly go through the list comparing adjacent pairs and swapping them if they are in the wrong order. After each pass the largest remaining value ‘bubbles’ to the end. Repeat until a pass makes no swaps.
  • Insertion sort — take each item in turn and insert it into its correct place among the items already sorted to its left.
Worked example — one bubble-sort pass on [5, 3, 8, 1]

Compare 5&3 → swap: [3,5,8,1]. Compare 5&8 → keep. Compare 8&1 → swap: [3,5,1,8].

After one pass: [3, 5, 1, 8] — the largest value (8) is now at the end.

Quick check

After one pass

?Starting from [4, 2, 7, 1], what is the list after one complete pass of bubble sort (comparing and swapping adjacent pairs left to right)?
Trace tables

Trace tables

A trace table records how the variables change as an algorithm runs, one row per step. It helps you find errors (dry run) and understand the logic.

Trace this loop

total = 0

FOR count = 1 TO 4

  total = total + count

NEXT count

counttotal 11 23 36 410
Each time round the loop, total gains the current count: final total = 10.
Calculate

Your turn — trace the loop

2Trace: total = 0, then FOR count = 1 TO 5 do total = total + count. What is the final value of total?
Hint: 1 + 2 + 3 + 4 + 5.
Validation & verification

Validation & verification

  • Validation — automatic checks that entered data is sensible / allowable (though not necessarily correct). Types: range check, length check, type check, presence check, format check.
  • Verification — checks that data has been entered or copied accurately. Methods: double entry (type it twice and compare) and visual/screen check (proofreading).

Careful: validation checks if data is reasonable; verification checks it was entered correctly. A valid value can still be verified wrong (e.g. a real but mistyped date).

Match it

Match the check to its meaning

Tap a description on the left, then its matching term on the right.

Description
Term
Quick check

Which check?

?A form only accepts a month number between 1 and 12. Which validation check is this?
Quick check

Computational thinking

?Designing a train map, a programmer keeps only the stations and lines and leaves out roads and rivers. Which skill is this?
Calculate

Your turn — linear search

3A linear search looks for the value 35 in the list [3, 7, 11, 18, 23, 29, 35], checking from the start. How many items must be examined before 35 is found?
Hint: 35 is the last of the 7 items, so every item is checked.
Quick check

One more

?Splitting the job ‘write a game’ into ‘draw graphics’, ‘handle input’ and ‘keep score’ is an example of…
Recap

The big ideas to know

Computational thinking: decomposition (break up) · abstraction (remove detail) · patterns

Design: flowcharts (symbols) & pseudocode

Search: linear (any list) · binary (sorted, halve each time)

Sort: bubble (swap adjacent pairs) · insertion (insert into sorted part)

Trace tables dry-run an algorithm to find errors

Validation (sensible data) vs verification (entered accurately)

You’ve covered the whole of Algorithm design and problem-solving. Press Finish to see your score.

🏆

Mini-lesson complete!

⭐⭐⭐

You’ve worked through Algorithm design and problem-solving for Cambridge IGCSE Computer Science. 🎉

Your stars: 0 / 0

Next: test yourself in the Evaluate stage Confidence Quiz, then lock it in with Verify.

📣 Smashed it? Share your score

Challenge a mate to beat your stars, or show a parent how you got on.

→ Back to all subjects