# What Is an Algorithm? A Simple Explanation with Examples

> An algorithm is a finite list of clear steps. Learn the idea through an airport example, see Python code, and meet al-Khwarizmi, whose name gave us the word.

*2026-10-29T13:06:07Z*

# What Is an Algorithm? A Simple Explanation with Examples

*Originally published in Arabic on parmgy.com on May 6, 2019. Updated October 2026.*

An algorithm is a finite, ordered list of clear steps that solves a problem or completes a task. A recipe is an algorithm, driving directions are an algorithm, and every computer program is built from algorithms.

<!-- video-embed: PLACEHOLDER — the short «Algorithm: the Arabic word every computer runs on» (URL after release) -->

## In the short video

1. **The hook:** the most famous word in programming is Arabic.
2. **A computer doesn't think by itself:** it needs every step, in order.
3. **Tea is an algorithm:** heat the water, add the tea, pour, stir. Four ordered steps that end in a result.
4. **The definition:** ordered, logical steps that solve a problem.
5. **The name:** from al-Khwarizmi (9th century), through the Latin «Algoritmi», to «algorithm»; his book *al-Jabr* gave us «algebra».

## Why the word "algorithm"?

The word comes from the name of the 9th-century scholar **Muhammad ibn Musa al-Khwarizmi** (c. 780 to c. 850), whose name was Latinized as "Algoritmi". He came from **Khwarazm**, a region in Central Asia that is today part of Uzbekistan and Turkmenistan, and he worked in Baghdad at the **House of Wisdom** during the 9th century. His book on Hindu-Arabic numerals reached Europe in Latin translation in the 12th century and spread the decimal system there. The word "algebra" also comes from the title of another of his books, *al-Jabr*.

Al-Khwarizmi did not invent "algorithms" as we use the word today. He described clear, step-by-step methods for calculation, and his name became the label for that kind of method.

## An everyday example: getting home from the airport

Imagine a friend landing at the airport who needs to reach your home. There are several valid algorithms for the same problem:

**Taxi algorithm**
1. Stop a taxi.
2. Get in.
3. Give the driver the address.

**Bus algorithm**
1. Leave the arrivals hall.
2. Take bus 70.
3. Change to bus 14 on the main road.
4. Get off at Flowers Street.
5. Walk left and count two houses.

Both reach the goal, but they differ in cost, time and number of steps. That is the heart of computer science: many algorithms can solve one problem, and we choose the one that fits.

## What makes a good algorithm?

- **Clear:** every step is unambiguous.
- **Finite:** it ends after a limited number of steps.
- **Has input and output:** it takes something in and produces a result.
- **Correct:** it gives the right answer for every valid input.
- **Efficient:** it doesn't waste time or memory.

## An algorithm in code

Here is a simple algorithm that finds the largest number in a list:

```python
numbers = [4, 17, 9, 23, 8]

largest = numbers[0]          # 1. assume the first is the largest
for n in numbers[1:]:         # 2. look at each remaining number
    if n > largest:           # 3. if it is bigger,
        largest = n           #    remember it instead

print(largest)                # 4. prints 23
```

The same steps could be written in any language. The algorithm is the idea; the code is just one way to express it.

## Flowcharts and pseudocode

Before writing code, many developers sketch the steps as a **flowchart** (boxes and arrows: start, process, decision, end) or as **pseudocode** (plain-language steps that look like code). Both help you check the logic before you commit to syntax.

## Algorithms in 2026

Search results, social media feeds, route planning and recommendations all run on algorithms. Machine learning models are also algorithms, though they learn their rules from data instead of following rules written by hand. To go deeper, look at searching, sorting and Big O notation, which measures how an algorithm's cost grows with its input.

## FAQ

**What is the difference between an algorithm and a program?**
An algorithm is the idea (the steps). A program is that idea written in a programming language so a computer can run it.

**Who invented the algorithm?**
No single person. The word honors al-Khwarizmi, but step-by-step methods are much older, such as Euclid's algorithm for the greatest common divisor.

**Is AI an algorithm?**
AI systems are built from algorithms, but a trained model's behavior comes from patterns learned from data, which is different from a short hand-written recipe.

**Do I need math to learn algorithms?**
Basic logic and arithmetic are enough to start. More advanced topics use more math.

## Sources

- Encyclopaedia Britannica, «al-Khwarizmi»: https://www.britannica.com/biography/al-Khwarizmi
- Wikipedia, «Algorithm — Etymology»: https://en.wikipedia.org/wiki/Algorithm
- Image credits (video): 1983 Soviet stamp (public domain) and the al-Khwarizmi statue in Urgench (Adam Harangozó, CC BY-SA 4.0), Wikimedia Commons.

---

Source: https://fadymondy.com/en/blog/what-is-an-algorithm
