---
title: What Is an Algorithm? A Recipe for Computers | Large Programs
description: An algorithm is a step-by-step set of instructions. A simple guide, with the story behind the word and how it differs from a machine-learning model.
canonical: https://www.largeprograms.com/what-is-an-algorithm/
---

[Home](/) / [Start Here](/category/start-here/)

Start Here

# What Is an Algorithm? A Recipe for Computers

An algorithm is a step-by-step set of instructions. A simple guide, with the story behind the word and how it differs from a machine-learning model.

27 November 2026 · 2 min read

An **algorithm** is a finite list of clear instructions used to solve a kind of problem or to do a calculation. It starts from some input, follows its steps, and ends with an output.

![Input, steps in order, output, like a recipe.](/img/algorithm.svg)

## A recipe is a good picture

A recipe tells you the steps to make a dish. An algorithm tells a computer the steps to solve a problem. "Finite" means it has an end: after a certain number of steps, it stops with an answer.

## Try one yourself

Here is an algorithm for finding the biggest number in a list:

1. Look at the first number and remember it as "biggest so far".
2. Look at the next number. If it is bigger, remember it instead.
3. Repeat step 2 until you reach the end of the list.
4. The number you remember is the biggest.

Try it with the list 4, 9, 2, 7. Then change the list and try again. The steps stay the same, even though the input changes.

## What a computer scientist asks of an algorithm

In *The Art of Computer Programming*, Donald Knuth says an algorithm is more than a finite set of rules for a type of problem. He lists five features. Two are **finiteness**, meaning it must always stop after a finite number of steps, and **definiteness**, meaning each step must be precisely defined. Another two are that it takes some input and gives some output (an algorithm can have zero or more inputs and outputs). A recipe that never says when to stop would not count.

## Where the word comes from

The word comes from the name of the Persian scientist and polymath al-Khwarizmi, who wrote books about Indian arithmetic around the year 825. When they were translated into Latin in the early 12th century, his name was written "Algoritmi".

## Algorithm or heuristic?

Some tools use a **heuristic** instead: an approach that may not give a correct or best answer, and that is used when there is no clear correct answer. The source gives social media recommendation systems as an example. People often call them "algorithms" in the news, but they cannot give correct results in the strict sense.

## How this connects to AI

An algorithm is a fixed list of steps that a person wrote. A machine-learning system also follows an algorithm, but the rules that decide its answers are learned from examples rather than written one by one. See [what machine learning is](/what-is-machine-learning/), and compare it with the paper rules in the [paper chatbot activity](/build-a-paper-chatbot-eliza-activity/).

## Sources

- [https://en.wikipedia.org/wiki/Algorithm](https://en.wikipedia.org/wiki/Algorithm)
- [https://www.informit.com/articles/article.aspx?p=2221792](https://www.informit.com/articles/article.aspx?p=2221792)

[Read this page as Markdown (.md)](/what-is-an-algorithm.md)

## Keep reading

[![](/img/hero/art-ai-glossary-llm-terms-for-adults.svg)](/ai-glossary-llm-terms-for-adults/)

Start Here

### [LLM Glossary for Beginners: 25 Terms Explained](/ai-glossary-llm-terms-for-adults/)

A plain-English glossary of terms such as parameter, token, embedding, inference, RLHF and more.

[![](/img/hero/art-ai-in-everyday-life.svg)](/ai-in-everyday-life/)

Start Here

### [AI in Everyday Life: Ten Places You Already See It](/ai-in-everyday-life/)

Maps, spam filters, photos, translation and more. A tour of everyday tools, many of which use AI or machine learning.

[![](/img/hero/art-ai-in-medicine-and-science.svg)](/ai-in-medicine-and-science/)

Start Here

### [AI in Science and Medicine: Helping, Not Replacing, Experts](/ai-in-medicine-and-science/)

AI helps scientists predict protein shapes, read scans and search data. Why human experts still lead.
