Understanding What an Algorithm Is
A Recipe, Step by Step
What Is an Algorithm?
An algorithm is a sequence of precise instructions that solve a problem or accomplish a task, step by step. You already use them without realizing it: a cooking recipe is an algorithm, and so is a furniture assembly plan.
Take the example of a recipe for preparing tea:
1. (Boil some water)
2. (Put a tea bag in a cup)
3. (Pour the hot water over the bag)
4. (Wait three minutes)
5. (Remove the bag)
Each line is an instruction: a simple, precise action. The set of these instructions, in this order, forms the algorithm.
In computer science, an algorithm works exactly the same way: it's a sequence of instructions that the computer will execute one after another, in the order they are written. The difference is that the computer never guesses anything: each step must be described without the slightest ambiguity, otherwise it won't be able to execute it correctly, or worse, it will make a mistake.
- An algorithm must be precise: each instruction has a clear meaning.
- An algorithm must be finite: it ends after a limited number of steps.
- An algorithm must be effective: it genuinely solves the problem at hand.
Before writing a program, a developer first thinks about the algorithm: what are the steps needed to solve this problem? Once the algorithm is clear on paper, it becomes much simpler to translate it into a programming language like Python. This is why algorithm design is often said to be the foundation of all programming.

