The word "algorithm" is everywhere in discussions about social media, search and artificial intelligence, but the idea is much older and simpler than it sounds. An algorithm is just a clear, step-by-step method for solving a problem or completing a task.
Key takeaways
- An algorithm is a finite list of instructions that produces a result.
- Recipes and directions are everyday algorithms.
- Computers follow algorithms written in programming languages.
- Good algorithms are correct, efficient and clear.
- Algorithms that learn from data can reflect biases in that data.
The word and its history
The term comes from the name of the ninth-century Persian mathematician Muhammad ibn Musa al-Khwarizmi, whose writings helped spread methods for calculating with the Hindu-Arabic numerals we use today. Long before computers, people used algorithms such as Euclid's method for finding the greatest common divisor of two numbers.
Everyday examples
A recipe is an algorithm: a sequence of precise steps that turns ingredients into a meal. So are instructions for assembling furniture or the steps you follow to long-divide numbers. Each has inputs, a series of actions, and an output. For something to count as an algorithm, the steps must be unambiguous and must finish after a limited number of steps.
A simple example in steps
Imagine you want to find the largest number in a list. A simple algorithm is:
- Look at the first number and call it the biggest so far.
- Look at the next number. If it is larger, make it the biggest so far.
- Repeat until you have looked at every number.
- The biggest so far is the answer.
A computer can carry out this procedure on millions of numbers very quickly.
How computers use them
Programmers express algorithms in programming languages, and the computer executes them exactly. Sorting a list, finding the shortest route on a map, compressing a photo and encrypting a message all rely on algorithms. Computer scientists compare algorithms by how long they take and how much memory they need as the input grows, a topic called computational complexity.
Algorithms that learn
Some modern systems, such as recommendation and image-recognition tools, use machine learning. Instead of following steps written by a person for every case, they adjust internal settings by studying many examples. The overall training procedure is still an algorithm, but the behaviour of the trained model comes from patterns in data.
Fairness and transparency
Because learning systems depend on their training data, they can reproduce unfair patterns in that data. An algorithm that decides who gets a loan or a job interview can disadvantage some groups unintentionally. Researchers and regulators discuss ways to test for bias, explain decisions and keep humans involved in important choices.
Famous algorithms
Some algorithms are so useful that they have become part of everyday computing. Binary search finds an item in a sorted list by repeatedly halving the range, so a million items can be searched in about twenty steps. Sorting algorithms such as quicksort and merge sort put lists in order. Dijkstra's algorithm, published in 1959, finds the shortest route through a network and underlies many mapping tools. PageRank, developed by the founders of Google, ranks web pages by the links pointing to them. The RSA algorithm, from the 1970s, lets people exchange secrets over open networks and helped make secure online shopping possible.
How we measure efficiency
Computer scientists describe how an algorithm's work grows with the size of the input using a notation called big O. An algorithm that takes steps in proportion to the number of items is called linear, while one that takes steps in proportion to the square of the number of items is quadratic. The difference matters enormously: doubling the input doubles the time for a linear algorithm but quadruples it for a quadratic one. Choosing an efficient algorithm can be the difference between a result in a second and one in a day.
Algorithms in daily life
You meet algorithms constantly. A navigation app picks routes using shortest-path methods and predictions about traffic. A streaming service suggests films using patterns from viewing habits. Your email filters spam by learning which words and senders are suspicious, and your phone compresses photos so they take less space. Banks use algorithms to detect unusual transactions. Many of these systems combine hand-written rules with machine learning, which makes their behaviour harder to explain.
Bias, transparency and regulation
Because algorithms can affect jobs, loans, policing and healthcare, their fairness matters. Examples have shown hiring tools that favoured certain groups because they were trained on past decisions, and risk-scoring tools that performed unevenly across communities. Researchers recommend testing for bias, publishing how systems work, keeping humans involved in important decisions and allowing people to challenge outcomes. Laws are emerging; for example, European data protection rules give people some rights concerning automated decisions, and further rules on artificial intelligence are being developed.
Learning about algorithms
You can explore algorithms without being a programmer. Online visualisers show sorting algorithms step by step, and puzzles such as the towers of Hanoi illustrate recursion. Simple exercises, like writing instructions for making a sandwich so precisely that a literal-minded robot could follow them, show how much detail an algorithm needs. If you want to go further, introductory programming courses often teach basic algorithms in the first few weeks.
Frequently asked questions
Is an algorithm the same as a program?
A program is an implementation of one or more algorithms in a specific language. The algorithm is the underlying method.
Do algorithms always make decisions?
No. Many simply calculate or transform data, such as sorting numbers or compressing a file.
Why do people blame "the algorithm" for what they see online?
Platforms use ranking algorithms to choose what to show, based on signals such as past activity, so the order of a feed is shaped by those rules.
What is big O notation?
Big O notation describes how the running time or memory needs of an algorithm grow as the input gets larger. It ignores small details and focuses on the overall pattern, such as linear growth, quadratic growth or logarithmic growth, so algorithms can be compared.
Is artificial intelligence just an algorithm?
AI systems are built with algorithms, including the training procedures that adjust a model from data. But the resulting model's behaviour comes from patterns learned from large amounts of data, so it is not a simple list of human-written steps.
What is a heuristic?
A heuristic is a rule of thumb that finds a good but not necessarily perfect answer quickly. Computers use heuristics for hard problems where finding the best solution would take too long, such as planning delivery routes.
Sources and further reading
Written by
FactNest Editorial Team
FactNest is operated by Muonix. The FactNest Editorial Team publishes general-interest explainers with AI-assisted drafting and illustrations. Contact contact@muonix.co for questions or corrections; we respond within 2 business days.
More from this author →


