Courses / Mathematics I
Programming Elements

Algorithms and Computational Thinking

Mathematics I 312 words Free to read

Solving Problems Step by Step

An algorithm is a finite, precise sequence of unambiguous steps that solves a problem or computes a result. The word predates computers — Euclid's method for the gcd (Unit 2) is an algorithm — but programming is the art of expressing algorithms so a machine can carry them out. For a procedure to be a genuine algorithm it should be finite (it terminates), definite (each step is unambiguous), and effective (each step is actually doable).

Computational thinking is the problem-solving mindset behind algorithm design. Its core habits:

Before coding, an algorithm is often written as pseudocode — structured, language-independent English that captures the logic without the syntax of any particular language — or as a flowchart. This lets you reason about correctness and efficiency separately from implementation details.

A subtle but essential point: a mathematical definition is not automatically an algorithm. "The gcd is the largest common divisor" defines the gcd but does not say how to compute it; Euclid's algorithm does. An algorithm must give a concrete, terminating procedure, not just characterise the answer. This distinction — between what a thing is and how to compute it — is the heart of turning mathematics into programs.

Common pitfall: confusing a definition or a specification (what the answer is) with an algorithm (a step-by-step procedure for computing it). "The prime factorisation is the unique product of primes" specifies the answer but is not an algorithm; you still need a concrete, terminating procedure (trial division, say) to actually produce it. An algorithm must tell you how, not merely what.

Practise this lesson

The explanation above is free to read. The graded practice for this lesson lives in the Tryals app.

11practice questions
2interactive scenes
Start Mathematics I free

Programming Elements