Concepts

Algorithm

4 min readbeginnerUpdated 28 Sept 2026
1 · In one line

An algorithm is a precise, step-by-step procedure for getting a result. In AI, learning algorithms are the procedures that turn data into a trained model.

1 · What it is

An algorithm is a precise list of steps for getting a result. Scanning a list one item at a time to find its largest number is an algorithm. So is a recipe followed to the letter. The steps must be exact enough that a computer, which has no common sense, can carry them out without guessing.

The largest-number procedure is deterministic: hand it the same list twice and it does the same work and returns the same answer. Speed matters as well: computer scientists track how long an algorithm needs to reach its result. Algorithms can also carry built-in assumptions. K-means, a common way to sort data into groups, must be told how many groups to find and copes poorly with oddly shaped ones.

Machine learning adds a second kind. A learning algorithm, such as gradient descent, does not answer the question directly. It describes how to adjust a model’s internal numbers, a little at a time, until the model’s guesses on known examples are as good as they can get. The output is a trained model, and it is the model that then answers new questions. So the learning algorithm and the model it produces are two separate things: one builds, the other predicts.

2 · Why it exists

Computers need every step spelled out.

No common senseA computer does exactly what it is told, so a vague instruction such as "sort these out" gives it nothing exact to carry out.
Repeatable resultsA deterministic algorithm, such as finding the largest number in a list, does the same work and gives the same result each time it gets the same input.
Rules too hard to writeForecasting rain from the physics of the atmosphere is extremely hard, so a learning algorithm can find the pattern in past weather data instead.
3 · How it works

Two kinds of algorithm, side by side.

A CLASSIC ALGORITHM Find the largest number in a list 1 Remember the first number. 2 Look at the next number. 3 If it is bigger, remember it instead. 4 Repeat until the list ends. 5 Answer with the number you remember. in: 7, 3, 12, 5 out: 12 Deterministic: same input, same answer. A person wrote every rule. A LEARNING ALGORITHM · GRADIENT DESCENT Examples go in Measure the error compare guesses with answers Find the downhill direction which way lowers the error Take a small step nudge every weight a little repeat until the error stops falling done Output: a model not an answer but a way to answer A person wrote these steps too. What comes out is learned from the data, then used to answer new questions.
  1. 1 · goalStart from a clear result you want, such as the largest number in a list or the lowest possible error.
  2. 2 · stepsWrite a sequence of precise steps that a computer can carry out exactly.
  3. 3 · codeImplement the steps in a programming language; the program is one realisation of the algorithm.
  4. 4 · learnIn machine learning, the steps describe how to adjust a model's numbers using examples, repeated many times.
  5. 5 · resultA classic algorithm returns an answer. A learning algorithm returns a trained model that produces answers later.

In machine learning, the algorithm and the model are two different things: the learning algorithm builds the model, and the model does the predicting.

4 · Where it's used
WhoWhat they askWhat it works with
Programmer“What is the largest value in this list?”A classic procedure that compares one item at a time
Streaming service“Which show should this viewer see next?”A recommender system that adapts to their preferences
ML engineer“How should the model's weights change to cut its error?”Gradient descent, run over the training data
Data analyst“Which customers behave alike?”A clustering algorithm such as k-means
5 · What it solves, and what it doesn't
solves
  • Turns a task into steps a computer can follow without guessing.
  • A deterministic algorithm gives the same result for the same input, so its behaviour can be predicted.
  • Learning algorithms can pull a pattern, such as how weather relates to rain, out of large amounts of data.
doesn't solve
  • Getting the right answer is not enough on its own: how long an algorithm needs to reach its result matters too.
  • A learning algorithm cannot fix unrepresentative data: if the examples describe a different group from the one the model will serve, its answers can be wrong.
  • Many algorithms need settings picked by people, such as how many groups k-means should look for.
6 · Go deeper

Sources used

This explainer is written in original language. The links below support its factual claims.

  1. officialalgorithm (Dictionary of Algorithms and Data Structures), NIST · read 27 Sept 2026
  2. docsIntroduction to Computer Science, 3.1 Introduction to Data Structures and Algorithms, OpenStax (Rice University) · read 27 Sept 2026
  3. docsMachine Learning Glossary, Google for Developers · read 27 Sept 2026
  4. docsLinear regression: Gradient descent (Machine Learning Crash Course), Google for Developers · read 27 Sept 2026
  5. officialUpdates to the OECD's definition of an AI system explained, OECD.AI · read 27 Sept 2026
  6. docs2.3. Clustering (User Guide), scikit-learn · read 27 Sept 2026
  7. officialdeterministic algorithm (Dictionary of Algorithms and Data Structures), NIST · read 27 Sept 2026
  8. docsWhat is Machine Learning? (Introduction to Machine Learning), Google for Developers · read 27 Sept 2026