What is an Algorithm?

An algorithm is just a set of step-by-step instructions for solving a problem — like a recipe, but for a computer.

Think of it like this

A recipe for a cup of tea is an algorithm: boil the kettle, add a teabag, pour the water, wait, add milk. It's a fixed list of steps that, followed in order, always produces the same result. Computers follow their recipes the same way — they just follow them millions of times faster, and they never skip a step.

What's happening

Diagram comparing a numbered tea-making recipe for humans with a spam-filter flowchart for computers, including a decision diamond, plus examples of everyday algorithms like map directions and social media feeds

Summary

An algorithm is a precise list of steps for getting something done. Every app you use is running thousands of them, from sorting your inbox to choosing what video plays next.

A Closer Look

What makes an algorithm different from ordinary instructions is precision. "Add some water" works for a human, but a computer needs every step spelled out exactly, including what to do when things vary — that's why algorithms are full of decisions like "if the message looks like spam, then move it to junk, otherwise put it in the inbox."

When people say "the algorithm" decided what's in their social media feed, they mean a particularly complex recipe — one that looks at what you've watched, liked, and lingered on, scores thousands of posts against that, and shows you the highest scorers. Modern feed algorithms are often built with machine learning, meaning the steps were partly learned from data rather than written entirely by hand.

Common Misconceptions

  • "The algorithm" is not one mysterious thing — every app uses many different algorithms, and most are as mundane as sorting a list alphabetically.
  • Algorithms are not smart or intentional — they don't "want" anything; they mechanically follow their steps, even when the result looks eerily personal.
  • Algorithms aren't only for computers — sorting your post, doing long division, or following flat-pack furniture instructions are all algorithms you run yourself.

How it connects

Algorithms are the recipes that all software is built from:

Try it yourself

Write down instructions for making a jam sandwich, then follow them completely literally — if you didn't write "open the jar," you can't open it. This is the classic exercise programmers use to learn how exact algorithms have to be, and it's surprisingly hard to get right first time.