What is an algorithm? Simple explanation
A set of steps a computer follows to solve a problem.
Last reviewedIn plain English
An algorithm is a set of steps for solving a problem or reaching a result. A recipe is an algorithm for cooking a dish. Directions to a friend's house are an algorithm for getting there. In computing, it is the same idea, written precisely enough that a computer can follow it.
A simple example
A very simple algorithm for finding the tallest person in a room: pick the first person as your current tallest, compare everyone else with them one at a time, and swap whenever you meet someone taller. When you reach the end, you have your answer. A computer can do exactly this with a list of numbers.
Algorithms and AI
In everyday news, "the algorithm" often means a whole system, such as a social network deciding what to show you. In AI, the word has a more specific meaning.
- A training algorithm is the set of steps used to teach a model from data.
- The model is what comes out: the learned result that makes predictions or writes text.
With traditional software, a person writes the rules. With machine learning, the training algorithm works out the rules from examples.
Common mix-ups
- An algorithm is not always AI. Sorting a list or calculating tax uses algorithms with no learning at all.
- An algorithm is not the same as a model. The algorithm is the method. The model is the trained result.
- "The algorithm did it" is not an explanation. Someone chose the data, the goal and the settings, and those choices matter.
Related terms
- Machine learningBuilding software that learns patterns from data instead of following only hand-written rules.
- ModelThe trained AI 'brain' that produces outputs. Companies release different models with different strengths and prices.
- Neural networkA type of machine-learning model made of many connected layers of simple maths units, loosely inspired by the brain.