Algorithm

Summary: A well-defined, step-by-step sequence of instructions that solves a specific problem or performs a task. Must be clear and unambiguous, terminate after a finite number of steps, and produce a defined output. Can be represented through pseudocode, flowcharts, and program code. Tags: igcse computer-science Created: 2026-05-08T14:03:00Z Last Updated: 2026-07-16


What is an Algorithm?

An algorithm is a precise, step-by-step procedure for solving a problem or completing a task. The term originates from the name of the 9th-century Persian mathematician Al-Khwarizmi.

Algorithms are the foundation of all computer programs. Every piece of software — from a sorting routine to a search engine — is built on algorithms. The same algorithm can be written in many different programming languages while remaining logically identical.

Properties of a Good Algorithm

For a sequence of steps to qualify as a proper algorithm, it must satisfy these five properties:

PropertyMeaning
Clear / UnambiguousEach step must have exactly one interpretation. There must be no room for guesswork or ambiguity.
FinitenessThe algorithm must terminate after a finite number of steps. It cannot run forever.
Defined InputsThe algorithm must specify what data it requires (if any) and in what form.
Defined OutputsThe algorithm must produce a result and specify what that result is.
EffectivenessEach step must be basic enough that it can, in principle, be carried out by a person using pencil and paper.

Representing Algorithms

Pseudocode

Pseudocode is a human-readable, language-independent way of describing algorithms. It uses structured English-like keywords and standard programming constructs without being tied to the syntax of any specific programming language.

IGCSE Computer Science uses a specific pseudocode style in Paper 2. Key constructs:

// Variable assignment
Count ← 0

// Conditional (Selection)
IF Temperature > 30
    THEN OUTPUT "Hot"
    ELSE OUTPUT "Not hot"
ENDIF

// Loop (Iteration)
WHILE Count < 10 DO
    OUTPUT Count
    Count ← Count + 1
ENDWHILE

// For loop (count-controlled)
FOR Index ← 1 TO 10
    OUTPUT Index
NEXT Index

// Repeat-until (post-condition)
REPEAT
    INPUT Value
UNTIL Value > 0

// Case statement
CASE OF Option
    1: OUTPUT "One"
    2: OUTPUT "Two"
    OTHERWISE: OUTPUT "Other"
ENDCASE

Flowcharts

A flowchart is a diagrammatic representation of an algorithm using standardised symbols connected by arrows.

SymbolShapePurpose
Start/EndOval (rounded rectangle)Marks the beginning or end of the algorithm
ProcessRectangleAny operation or calculation (e.g., x ← x + 1)
DecisionDiamondA condition / question with two exits: Yes (True) and No (False)
Input/OutputParallelogramReading data (INPUT) or displaying results (OUTPUT)
Flow LineArrowShows the direction of the next step

Flowcharts are useful for visualising the logical flow of an algorithm before coding, especially for conditional branching and loops.

Program Code

The algorithm written in a specific programming language (Python, Java, C++, etc.). Unlike pseudocode, program code can be compiled and executed directly.

Common Algorithmic Constructs

ConstructDescriptionPseudocode Keywords
SequenceInstructions executed in order, one after another(statements in order)
SelectionChoosing between different paths based on a conditionIF-THEN-ELSE-ENDIF, CASE-OF-ENDCASE
IterationRepeating a block of codeFOR-NEXT, WHILE-DO-ENDWHILE, REPEAT-UNTIL
AssignmentStoring a value in a variable

These three constructs (sequence, selection, iteration) are sufficient to express any computable algorithm — this is known as the structured program theorem.

Common Algorithms in IGCSE

AlgorithmPurposeComplexity
Linear SearchFind an item in an unsorted listO(n)
Binary SearchFind an item in a sorted listO(log n)
Bubble SortSort a list by comparing adjacent pairsO(n²)
TotallingSum values in a listO(n)
CountingCount occurrences meeting a conditionO(n)
Validation CheckEnsure input data is reasonableVaries

Sources

  • BBC Bitesize GCSE Computer Science — Algorithm Design, BBC (free educational resource)
  • Cambridge IGCSE Computer Science 0478 — Algorithm Design and Problem-Solving, Cambridge Assessment International Education
  • CK-12 Computer Science — Algorithms, CK-12 Foundation (free, CC BY-NC 3.0)

Common Misconceptions

MisconceptionReality
”An algorithm has to be mathematical”Algorithms can describe any process: making a cup of tea, deciding whether to bring an umbrella, or finding the shortest bus route. They are not inherently mathematical.
”Pseudocode has a single official standard”There is no universal pseudocode standard. The IGCSE syllabus defines its own specific format for exams, but other organisations use different conventions.
”All algorithms are fast”Some problems have no known efficient algorithm. Sorting takes at least O(n log n) comparisons; some problems (NP-hard) may require impractically long computation times.
”If it works, it is a good algorithm”An algorithm can be correct but inefficient (e.g., bubble sort on a million items). Good algorithms are both correct and efficient for the expected input size.
”Flowcharts are just for beginners”Flowcharts are used professionally in systems design, business process modelling, and safety-critical systems where visual verification of logic is essential.