Back to Learning Area

What Is an Algorithm?

What Euclid, IKEA instructions, and Google search have in common — all three follow fixed sequences of steps.

  • Fundamentals
  • 12 min
  • Beginner

Plain Language

This preview is in Plain Language. The whole portal is also available in Plain Language. You can change the language at the top. Or use the button below. Our Plain Language texts are AI-assisted and editorially reviewed. They follow the core principles of easy-to-read language, but they are not certified Easy Read: a review panel of people with learning difficulties does not test them.

Preview: What is an algorithm?

The idea behind it

An algorithm is a sequence of steps. Each step is precisely described. A computer follows these steps. In the end, it solves the problem.

Recipe vs. algorithm

A recipe says: heat the butter. A human understands that. But a computer does not. An algorithm says precisely: heat 15 grams of butter at 120 degrees. No step may be unclear.

Algorithms and AI

Every AI works with algorithms. Without algorithms, there is no AI. Algorithms can, for example, recognize images. Or they sort search results. Or they translate text.

You follow algorithms every day — crossing the street, making coffee, unlocking your phone. But what turns a casual sequence of steps into something a computer can execute?

The name "algorithm" traces back to the Persian scholar Al-Khwarizmi, who lived in the 9th century — the word itself emerged from the Latin translations of his works in the 12th century. In this article, you will learn what distinguishes a real algorithm from vague instructions — and why this concept is the foundation of every AI system.

The Algorithm: A Precise Sequence of Steps

Definition

Algorithm

Analogy

An algorithm is like an IKEA assembly manual: numbered steps, defined parts (input), and a guaranteed result (output). Each step says exactly which screw goes where. But the manual itself does not build anything — it only describes what needs to be done.

The IKEA analogy breaks at an important point: IKEA instructions contain visual ambiguity — which hole? Which orientation? A real algorithm cannot have such ambiguity. This is the core insight: algorithms demand MORE precision than even good human instructions.

Let's see this in a concrete example — Euclid's algorithm. It calculates the greatest common divisor (GCD) of two numbers. Instead of trying all possible divisors, you stubbornly follow one rule: divide the larger number by the smaller one, then the divisor by the remainder, until the remainder is 0:

Example: Euclid's GCD Algorithm (252, 105)

  1. 1. 252 ÷ 105 = 2, remainder 42
  2. 2. 105 ÷ 42 = 2, remainder 21
  3. 3. 42 ÷ 21 = 2, remainder 0
  4. 4. Remainder is 0 → the last divisor (21) is the GCDin just 3 steps, over 2,300 years old

Caution

Common Misconception: Algorithm = Program

An algorithm is the abstract logic — a program is one concrete implementation in a specific programming language. The same algorithm (e.g., Euclid's GCD) can be written in Python, Java, or executed by hand on paper. The algorithm exists independently of any programming language.

Recipe vs. Algorithm: Why Precision Matters

A cooking recipe says: "Heat butter in a pan, add eggs, stir gently until done." This works for a human — but a robot would fail. How much butter? What temperature? What does "gently" mean? The gap between recipe and algorithm is the gap between natural language and formal language.

Recipe (for humans)

"Heat butter, add eggs, stir gently until done." — Works because humans can improvise. Vague terms like "a pinch of salt" or "golden brown" assume experience.

Algorithm (for machines)

"Heat 15g butter at 120°C for 90 seconds. Pour in 150ml beaten egg mixture. Move spatula in 3cm circles at 1 revolution per second. Stop when internal temperature reaches 74°C." — Every step is measurable and unambiguous.

When you tell a human "sort 5, 2, 8, 1, 4", they just do it. An algorithm must specify HOW: compare the first two numbers, swap if needed, move to the next pair, repeat until no swaps are needed. The human uses intuition; the algorithm uses explicit rules. Both reach the same result — but only the algorithm can be given to a machine.

Note

Correct Does Not Mean Good

Two algorithms can both correctly sort a list, but one might take 10 steps and the other 10,000. Correctness and efficiency are separate qualities. A correct algorithm solves the problem — a good algorithm solves it fast.

Interactive: Bubble Sort

The article says: "Compare the first two numbers, swap if needed, move to the next pair." Here you can step through exactly that — and see how Bubble Sort sorts the list [5, 2, 8, 1, 4].

5
2
8
1
4
Step 1 / 11Starting position: The unsorted array [5, 2, 8, 1, 4]. Bubble Sort compares adjacent elements and swaps them if they are in the wrong order.
Controls
Steps

Interactive: The Treasure Robot (Knapsack Problem)

A robot has to pack the most valuable treasures into a backpack with limited room. Just greedily grabbing the most valuable per kilo first often backfires. Here you can see how an algorithm cracks it: it fills a table cell by cell — each cell stores the best value (take a treasure or leave it) — and at the end reads the optimal backpack backwards out of the table.

From Babylon to Turing: 4,000 Years of Algorithmic Thinking

Algorithmic thinking is not a modern invention. The core idea — breaking problems into repeatable, mechanical steps — is almost 4,000 years old. Five milestones mark the journey:

Babylonian Clay Tablets

~1800 BC

Step-by-step procedures for calculating areas, volumes, and square roots.

Euclid

~300 BC

The GCD algorithm in "Elements" — according to Donald Knuth, the oldest nontrivial algorithm that has survived to the present day.

Al-Khwarizmi

~820 AD

Persian mathematician whose book "Kitab al-Jabr" gave us the word "algebra" and whose Latinized name "Algoritmi" became "algorithm."

Ada Lovelace

1843

Her algorithm for Bernoulli numbers on Babbage's Analytical Engine is often called the first published computer program.

Alan Turing

1936

Formalized what "computable" means. Proved that some problems are fundamentally unsolvable by any algorithm.

The word itself tells the story: Al-Khwarizmi → Latinized to "Algoritmi" → became "algorithm" in European languages. When you say "algorithm," you are literally invoking a 9th-century Persian scholar.

In 1936, Alan Turing proved that certain problems are fundamentally unsolvable — no matter how clever the algorithm. The most famous example is the halting problem: there is no algorithm that can predict, for every possible program, whether it will eventually halt or run forever. Turing drew the absolute boundary of algorithmic thinking.

Note

Synthesis: From the Abacus to Artificial Intelligence

From Babylonian scribes to Persian mathematicians to modern computer scientists — the algorithm is one of humanity's oldest mental tools for turning chaos into repeatable, verifiable solutions.

And this is where AI connects: every neural network training loop, every search engine ranking, every recommendation is an algorithm. Without this concept, AI remains a black box.

Note

Key Takeaways

  1. An algorithm is a finite, unambiguous sequence of instructions. In classical algorithms, the same input always produces the same output.
  2. Three properties characterize classical algorithms: determinism, finiteness, unambiguity. Randomized algorithms use randomness but remain precisely defined in every step.
  3. An algorithm is not the same as a program. The algorithm is the abstract logic; the program is a concrete implementation.
  4. The gap between recipe and algorithm is the gap between human improvisation and machine precision.
  5. Algorithmic thinking is almost 4,000 years old — from Babylonian clay tablets through Al-Khwarizmi to Turing's proof of the limits of computability.

Check

Quiz: Understanding Algorithms

Not completed

Which of the following is NOT a core property of a classical algorithm?

Select one answer

Answer Key: 1) B · 2) B · 3) B · 4) B

Check

Checkpoint: Test Your Knowledge

Can you explain this in your own words? Tick what you've got.

0 of 3 done