Library › Computer Science 0478 › Standard Methods of a Solution
O Level · Computer Science 0478

Standard Methods of a Solution

Revise Standard Methods of a Solution for Computer Science 0478 (O Level) — revision notes and instant AI marking.

📖 Revision notes · preview
  Cambridge (CIE) IGCSE — Computer Science

Standard Methods of a Solution

Big idea: most exam algorithms are just a handful of repeatable patterns — search, sort, total, count, and find the max/min/average — and once you know the pattern, you can write it for any dataset.

Quick Summary
Skim this first. Every bullet gets its own full section below.
Linear SearchCheck every value, one at a time, from the start, until you find the target or run out of values.
Bubble SortCompare neighbouring pairs and swap them if they're in the wrong order. Repeat passes until a whole pass makes zero swaps.
TotallingKeep a running sum by adding each new value to a variable that starts at 0.
CountingIncrease (or decrease) a counter by a fixed amount, usually 1, each time something happens.
Max / Min / AverageFind the biggest, smallest, and mean value in a list — average = total ÷ count.
Why it mattersThese five patterns appear, combined and recombined, in almost every algorithm question on the paper.
1. Linear Search
Finding a value the "brute force" way

1What is a searching algorithm?

A searching algorithm is a precise, step-by-step set of instructions a computer follows to find a specific piece of data inside a (possibly huge) dataset — like finding one name in a phone book with a million entries, but doing it in a way a computer can follow exactly, with no "just eyeballing it."

2What is a linear search?

Imagine you're looking for your friend's name in an unsorted stack of index cards. You don't know where it is, and the cards aren't in any order — so your only honest option is to pick up the first card, check it, then the second, then the third, and so on, until you either find the name or run out of cards. That's exactly what a linear search does.

  • It starts at the first value in the dataset.
  • It checks values one at a time, in order.
  • It can be used even if the data is completely unsorted — that's actually its one big advantage over faster searches like binary search, which require sorted data.
The Rule
1. Check the first value.
2. IF it matches → STOP, found it.
3. ELSE move to the next value.
4. REPEAT until you've checked everything (or found it).

Here's the pseudocode from the textbook, worked through step by step. We're searching for target = 11 in data = [5, 2, 8, 1, 9]:

DECLARE data : ARRAY[1:5] OF INTEGER
DECLARE target : INTEGER
DECLARE found : BOOLEAN

data ← [5, 2, 8, 1, 9]
target ← 11
found ← FALSE  // assume not found until proven otherwise

FOR index ← 1 TO 5
   IF data[index] = target THEN
      found ← TRUE
      OUTPUT "Target found"
   ENDIF
NEXT index

IF found = FALSE THEN
   OUTPUT "Target not found"
ENDIF

Notice the shape of this: a flag variable (found) starts as FALSE, and only flips to TRUE if a match is discovered. After the loop finishes, you check the flag to decide what to output. This "flag pattern" shows up constantly in IGCSE pseudocode — get comfortable with it.

Why Python's version is smarter break
Practice Question 1

[12, 45, 3, 67, 9] 67

Practice Question 2

[12, 45, 3, 67, 9] 100 found

2. Bubble Sort
Sorting by repeatedly comparing neighbours

1What is a sorting algorithm?

2

pass zero swaps

🔓 Read the full Standard Methods of a Solution note → You're seeing the preview · sign in to read it all
Also in the full note
  • 2What is a bubble sort?
  • 1What is totalling?
  • 2What is counting?
  • 1Why these three together?
What's inside
📖 Revision notes 🎯 Learn mode ✦ AI flashcards ✓ Instant AI marking 🧊 3D explorers 🧪 Experiments & simulations 📈 Progress tracking
📄 Practise Standard Methods of a Solution with Computer Science 0478 past papers Every paper with its mark scheme — answer online, marked instantly. Open →

Read the full Standard Methods of a Solution notes free

That's the preview — create a free account to read the rest, plus flashcards and practice questions with instant AI marking. No credit card.

Unlock the full notes free →

More Computer Science topics