Skip to content

algorithm

An algorithm is a finite sequence of well-defined steps that takes zero or more inputs and produces an output, solving a problem or computing a result. Each step must be unambiguous, and the process must finish after a finite number of steps:

An algorithm takes optional input, runs a finite sequence of steps from Step 1 to Step N, and produces one or more outputs.
From Input to Output in Finite Steps

Algorithms are independent of any programming language. The same procedure can be written in Python or C, or expressed as plain prose, a flowchart, or pseudocode before it becomes runnable code.

Correctness and efficiency are judged separately. An algorithm is correct when it returns the right output for every valid input, and its efficiency is described by time complexity and space complexity, usually in Big O notation.

Common families include sorting algorithms that arrange data into order and search algorithms such as binary search that locate a value. Graph algorithms form another family, traversing networks of connected nodes.

An algorithm usually operates over a data structure that organizes the data it works on, and the choice of structure often shapes which algorithms are practical.

Tutorial

Sorting Algorithms in Python

In this tutorial, you'll learn all about five different sorting algorithms in Python from both a theoretical and a practical standpoint. You'll also learn several related and important concepts, including Big O notation and recursion.

intermediate algorithms python

For additional information on related topics, take a look at the following resources:


By Martin Breuss • Updated June 22, 2026 • Reviewed by Leodanis Pozo Ramos