Introduction to Algorithms
Algorithms: Foundations, History, and Applications
What an Algorithm Is
An algorithm is a step-by-step computational procedure for solving a problem. It can be understood as a recipe: it receives specified inputs, carries out a sequence of operations, and produces an output.
A problem’s specification describes what inputs are allowed and what output is required. For example, a multiplication problem can be specified as follows:
Inputs: Two integers, m and n
Output: Their product, m×n
An instance of a problem is a particular choice of input values. For example, choosing m=234 and n=121 gives one instance of the multiplication problem. The algorithm must process those values and return 28,314.
An algorithm is not the answer to one particular instance. It is the general procedure that can be applied to many valid instances.
An algorithm turns inputs into outputs by following a defined sequence of computational steps.
Algorithms and Mechanical Execution
Once an algorithm is designed, carrying it out should be a mechanical process. The executor follows the instructions step by step rather than relying on fresh creativity at each stage.
The grade-school method for multiplication illustrates this idea:
Multiply one number by each digit of the other number.
Shift each partial product according to the digit’s place value.
Add the partial products, carrying when necessary.
For 234×121, the partial products are 234, 4,680, and 23,400. Adding them gives 28,314. This written procedure is an algorithm because it specifies how to compute the product systematically.
Algorithms Across History
Algorithms are not a recent invention. People have needed systematic procedures for calculation since ancient times. They used algorithms to support practical tasks such as measuring land, tracking the calendar, and predicting astronomical events.
Early Calculation Practices
Different mathematical traditions developed methods for carrying out computations:
Chinese mathematics included calculation techniques using the abacus.
Ancient Indian mathematics developed the place-value number system and arithmetic procedures suited to it. Place value made it possible to represent numbers compactly and perform calculations systematically.
Greek mathematics produced procedures such as the Euclidean algorithm for finding the greatest common divisor of two integers and the sieve of Eratosthenes for identifying prime numbers.
These examples show that algorithms developed wherever people needed reliable ways to calculate. They were part of mathematical practice long before the modern computer.
The Origin of the Word “Algorithm”
The word algorithm is historically connected to the name of the Persian mathematician al-Khwarizmi. His mathematical writing, including work on arithmetic and equation-solving, became influential after it was translated into Latin. A Latinized form of his name helped give rise to the term.
The numeral system often called the Arabic numeral system originated in India and was transmitted through Arabic-speaking scholars and traders to Europe. The name reflects the route by which the system became known in the West, rather than its original place of invention.
Algorithms Before Computers
For much of mathematical history, algorithms were sometimes treated as less important than the theorems they helped establish. A mathematical result might be considered the main contribution, while the procedure used to obtain it was treated as secondary.
This changed when computers made it possible to perform calculations at scales that would be impractical for people to complete reliably by hand. Tasks such as multiplying very large numbers or testing very large numbers for primality created a need for procedures that were not only correct but also efficient.
Algorithms consequently became a subject of study in their own right. They draw on mathematics, but they are also central to computer science because they are designed as procedures that can be carried out by computational machines.
Computation and the Turing Machine
The idea of a computational procedure raises a fundamental question: What counts as a computation? In the 1930s, Alan Turing proposed a formal model of computation called the Turing machine. It provides a precise, abstract way to describe how a machine can carry out computations by following rules.
The Turing machine helped make the idea of a computational procedure mathematically precise. It also established a foundation for reasoning about which problems can be computed and what computation means in principle.
The Church–Turing Thesis
The Church–Turing thesis, associated with Alan Turing and Alonzo Church, is the claim that any procedure that can be effectively carried out by a physical computing system can also be represented by a Turing machine. It links an informal idea—computation that can be performed by a systematic method—to a formal mathematical model.
The thesis is not a description of the hardware inside every real computer. Rather, it is a claim about the computational power of formal models: physically realizable computers are not believed to compute beyond what a Turing machine can compute, assuming the standard understanding of physical computation.
A detailed study of Turing machines is not required to understand every practical algorithm. Nevertheless, the model matters because it gives computer science a rigorous foundation for discussing computation.
Algorithms as a Modern Field of Study
With the arrival of computers, the study of algorithms became especially important. A computer can carry out enormous numbers of elementary operations, but the method it follows still determines whether a task can be completed correctly and efficiently.
Modern algorithm study asks questions such as:
How can a problem be solved by a precise procedure?
Does the procedure produce the required answer?
How much time or other computational resources does it require?
Can a more efficient procedure be designed?
An algorithm is therefore more than an abstract mathematical idea: it is a computational recipe intended to be executable by a computer.
Algorithms as a Technology
Algorithms are often invisible to users, but they power many digital services and practical systems. A single service may combine numerous algorithms to process data, make decisions, and provide results quickly.
Search Engines
A search engine must identify pages relevant to a query and present them in a useful order. A location-based search for nearby restaurants illustrates the range of information and processing involved:
The system interprets the search query, such as “Greek restaurants.”
It uses the user’s approximate location, when available and permitted, to focus on nearby results.
It searches precomputed indexes that connect search terms and locations to relevant businesses.
It may retrieve additional information, such as reviews.
It assembles the results into a page for the user.
Indexes make it possible to search large collections of information quickly. The system must return results promptly; otherwise, even useful search results would feel unresponsive.
Navigation and Route Planning
A navigation service must represent roads and locations in a form that can be processed. For a trip from location A to location B, it can search for a shortest path through the road network.
In practice, the route with the smallest distance is not necessarily the best route. Navigation systems may also consider current traffic, estimate travel times, and offer alternative routes. These tasks require combining information about the road network with algorithms for searching paths and evaluating travel conditions.
Airports and Airline Operations
Airports and airlines manage limited resources while coordinating many vehicles and schedules. Examples include:
Scheduling: Deciding when aircraft should use runways or taxiways.
Assignment: Allocating aircraft to gates or assigning aircraft to routes.
Resource coordination: Responding when delays, breakdowns, or other disruptions make the original plan impractical.
Logistics: Moving baggage and other resources through the airport system.
Some decisions may be made by human operators, but algorithmic methods can help organize options and support efficient schedules. The challenge is often to coordinate many constraints at once, such as aircraft availability, airport capacity, timing, and changing conditions.
Package Delivery and the Traveling Salesperson Problem
Package delivery involves several connected optimization problems. A carrier must decide how to move packages between facilities, choose appropriate transportation, and plan delivery routes.
A truck that must visit multiple addresses and return to its starting depot faces a problem related to the traveling salesperson problem (TSP). In its basic form, the goal is to find a route that visits every required location and returns to the start while minimizing total distance or cost.
The TSP is computationally difficult: as the number of locations grows, the number of possible routes can grow extremely rapidly. Finding the best route exactly can therefore become impractical for large instances. Even so, improved algorithms and good approximate solutions can reduce travel, fuel use, and operating costs.
Matching People with Positions
Algorithms can also help match people or resources to opportunities. A prominent example is the stable matching problem, which concerns pairing two groups—such as applicants and positions—when each side has preferences.
A matching is stable if there is no unmatched pair who would both prefer to be matched with each other rather than remain with their assigned partners. The Gale–Shapley procedure is a well-known method for producing a stable matching.
Stable matching has practical applications, including:
Assigning medical residents to hospitals or training positions
Matching kidney donors with patients in transplant systems
Allocating applicants to programs when both sides have ranked preferences
These applications demonstrate that algorithms can help coordinate preferences and limited opportunities, not just perform arithmetic.
The Nobel Prize in Economic Sciences for work on the theory of stable allocations and market design was awarded to Lloyd Shapley and Alvin Roth. Gale and Shapley are associated with the stable matching algorithm; the Nobel recognition was not awarded to Gale.
Why Algorithms Matter
Algorithms influence everyday life by making large-scale coordination and computation possible. They support search, navigation, scheduling, assignment, and logistics—often behind the scenes.
Their value comes from several capabilities:
Speed: They can process information quickly.
Consistency: They apply defined procedures systematically.
Efficiency: Better procedures can reduce wasted time, fuel, capacity, or other resources.
Scale: They can handle problems far beyond what people could reliably calculate by hand.
Studying algorithms means learning how to design and evaluate computational procedures that solve problems effectively. Their impact ranges from basic arithmetic to systems that coordinate transportation, information, and essential services.

Ask anything
We've read this whole study set, so questions about it get the best answers.