What Is an Algorithm? The Step-by-Step Recipes That Run the World
An algorithm is a precise set of instructions for solving a problem or completing a task. Learn what algorithms actually are, how they power everything from Google Search to social media feeds, and why algorithmic literacy matters in the modern world.
Explain It Simply Editorial Team
Published May 17, 2026
What Makes Something an Algorithm
An algorithm must have five properties to qualify as one, distinguishing it from vague instructions or general guidelines.
Finiteness: the algorithm must terminate — it must eventually stop and produce a result. An instruction like 'keep trying until it works' is not an algorithm if it could run forever. A recipe that says 'bake for 12 minutes' is finite; one that says 'bake until perfect' is ambiguous.
Definiteness: each step must be precisely defined with no ambiguity. 'Add a pinch of salt' is ambiguous (how much is a pinch?). 'Add 1/4 teaspoon of salt' is definite. Computers are literally incapable of handling ambiguity — every instruction must have exactly one interpretation.
Input: an algorithm takes zero or more inputs — the data it processes. A sorting algorithm's input is an unsorted list. Google Search's input is your query plus the entire indexed web.
Output: an algorithm produces one or more outputs — the result. A sorting algorithm outputs a sorted list. Google Search outputs ranked search results.
Effectiveness: each step must be basic enough to be carried out in principle. An instruction like 'determine if the number is prime' is effective for small numbers but needs to be broken down into more basic steps for large ones.
The concept of algorithms predates computers by millennia. The word 'algorithm' comes from the name of the 9th-century Persian mathematician al-Khwarizmi, whose book on Hindu-Arabic arithmetic introduced systematic calculation methods to Europe. Euclid's algorithm for finding the greatest common divisor (circa 300 BCE) is still used today, over 2,300 years later.
Every algorithm follows the same pattern: take input, process through defined steps, produce output.
Classic Algorithms Everyone Should Know
A handful of fundamental algorithms underpin most of computing.
Sorting algorithms arrange data in order — alphabetical, numerical, by date, by relevance. This sounds trivial, but sorting is one of the most-studied problems in computer science because virtually everything depends on it. Searching sorted data is exponentially faster than searching unsorted data. Common sorting algorithms include QuickSort (fast on average, used in most programming languages), MergeSort (consistently fast, used when stability matters), and BubbleSort (simple but slow — a teaching example of what NOT to use at scale).
Search algorithms find specific items in data. Linear search checks every item one by one — works but is slow for large datasets. Binary search cuts the dataset in half with each step — to find a name in a phonebook of 1 million entries, binary search needs at most 20 comparisons (because 2^20 ≈ 1 million). This is why sorted data is so valuable — it enables binary search.
Graph algorithms find paths through networks. Google Maps uses Dijkstra's algorithm (or variants) to find the shortest route between locations. Social networks use graph algorithms to suggest friends (people connected to your connections). Package delivery companies use the Traveling Salesman Problem (finding the shortest route visiting all destinations) — one of the most famous unsolved problems in computer science, with no known efficient algorithm for large numbers of destinations.
Encryption algorithms protect information. RSA encryption relies on the mathematical fact that multiplying two large prime numbers is easy, but factoring their product back into primes is extraordinarily difficult. Your bank, your messages, and your passwords are all protected by this asymmetry.
Machine learning algorithms 'learn' patterns from data rather than following pre-programmed rules. A spam filter doesn't have hand-written rules for every type of spam — it analyzes millions of emails labeled 'spam' and 'not spam' and learns to distinguish patterns. The algorithm improves as it sees more data.
Algorithms That Shape Your Daily Life
You interact with dozens of consequential algorithms every day, usually without knowing it.
Google Search uses PageRank (among hundreds of other signals) to rank billions of pages. The core insight: a page is important if important pages link to it. This recursive definition creates a mathematical framework where every page's importance depends on every other page's importance — solved through linear algebra (eigenvalue computation). Google processes over 8.5 billion searches per day using this system.
Social media feeds use recommendation algorithms to decide what you see. Facebook's News Feed algorithm considers thousands of signals — your past interactions, the poster's relationship to you, the post's engagement rate, content type, recency, and more. The algorithm optimizes for engagement (time spent on the platform), which unfortunately means content that provokes strong emotions (especially outrage) tends to be amplified.
Netflix and YouTube recommendation engines drive 80% of content watched on their platforms. Netflix estimates its recommendation algorithm saves the company $1 billion per year by reducing subscriber churn — people who find content they like stay subscribed.
Credit scoring algorithms (FICO) determine whether you get a loan and at what interest rate. These algorithms analyze payment history, credit utilization, length of credit history, types of credit, and recent inquiries to produce a score between 300 and 850.
Hiring algorithms increasingly screen job applications. Large companies receive thousands of applications for each position and use algorithmic screening to filter candidates based on resume keywords, qualifications, and other signals. Studies have found these algorithms can perpetuate biases present in historical hiring data — if a company historically hired mostly men for engineering roles, the algorithm may learn to penalize resumes with indicators of being female.
Sources: Cormen et al., 'Introduction to Algorithms' (MIT Press), Knuth, 'The Art of Computer Programming', Brin & Page, 'The Anatomy of a Large-Scale Hypertextual Web Search Engine' (1998), O'Neil, 'Weapons of Math Destruction' (2016).
💡 AHA Moment
Here's the insight about algorithms that reframes how you see the digital world: an algorithm is just a recipe. That's it. A precise, unambiguous set of steps that transforms an input into an output.
A recipe for chocolate chip cookies is an algorithm: inputs (flour, sugar, butter, eggs), steps (mix dry ingredients, cream butter and sugar, combine, bake at 350°F for 12 minutes), output (cookies). IKEA assembly instructions are an algorithm. Driving directions are an algorithm.
So why do algorithms seem so mysterious and powerful? Because the SCALE changes everything. A recipe that one person follows once is trivial. An algorithm that a computer follows a billion times per second across billions of users — sorting, recommending, filtering, ranking — reshapes society.
Google's PageRank algorithm doesn't do anything a librarian couldn't theoretically do (rank pages by relevance). But the librarian can rank 10 pages per hour. Google ranks 8.5 billion pages in 0.3 seconds. The algorithm isn't magic — the SPEED is magic. And when you combine simple rules with incomprehensible speed and scale, simple recipes produce godlike power.
Want a deeper explanation?
Use our AI tool to get personalized, interactive explanations on any topic.
auto_awesomeTry It Free