Skip to story
ELI5 Yahaaa

A recipe with no judgement

What Makes Something an Algorithm?

An algorithm is a set of steps so precise that following them needs no thinking.

Start at a fixed pointEach step isunambiguousDecisions have clearrulesIt always finishes
A recipe so exact that no judgement is needed.
  1. Step 1 of 5

    Ordinary instructions rely on judgement.

    Season to taste?Needs a human decisionAdd 5 grams of salt=Anyone can follow it

    A recipe saying season to taste assumes a cook who can decide. A machine has no taste and no opinion, so that instruction is useless to it.

  2. Step 2 of 5

    Every step must have exactly one meaning.

    1 One clearstarting point2 One unambiguousstep at a time3 Decisions withdefinite rules

    There can be no room for interpretation. Each instruction has to produce the same result whoever, or whatever, carries it out.

  3. Step 3 of 5

    Decisions are allowed if the test is precise.

    Check a conditionis A biggerthan B?Yes — do one thinga definitebranchNo — do the otherthe otherdefinite branch

    If this, then that is perfectly fine as long as the condition can be checked without opinion, such as comparing two numbers.

  4. Step 4 of 5

    Repetition does the heavy lifting.

    Compare two items Swap if outof order Move along one=Repeat untilsortedRepeat

    A short list of steps repeated many times can sort thousands of items. The instructions stay small while the work becomes large.

  5. Step 5 of 5

    It has to stop.

    StartRepeat whilethere is workStop when thereis none

    A procedure that never finishes is not much use. A genuine algorithm reaches an end for every input it is designed to handle.

    The word comes from al-Khwarizmi, a ninth-century Persian mathematician whose name reached Latin as Algoritmi.

The short version

An algorithm is a sequence of steps precise enough to need no judgement, with definite decisions, and it always finishes.

Try it yourself

Write instructions for making toast, then have someone follow them absurdly literally. Every vague step becomes obvious immediately.

Topics