Algorithm
A finite sequence of steps used to solve a problem or complete a computation.
Example: Bubble Sort is an algorithm for ordering values.Foundations
Keep this reference nearby while you learn. Every definition includes a concrete example, without assuming a computer-science background.
A finite sequence of steps used to solve a problem or complete a computation.
Example: Bubble Sort is an algorithm for ordering values.A way to describe how an algorithm's resource use grows as its input grows.
Example: O(n²) means the work can grow roughly with the square of the input size.How the number of operations grows as the input becomes larger.
Example: Binary Search has O(log n) time complexity.How much additional memory an algorithm needs as the input grows.
Example: An in-place swap can use O(1) extra space.A sorting algorithm that preserves the original order of items with equal keys.
Example: If 4A appears before 4B, a stable sort keeps 4A first.An algorithm that transforms its input using only a small, constant amount of extra memory.
Example: Bubble Sort swaps values inside the same array.A technique where a function solves a problem by calling itself on a smaller version of that problem.
Example: Tree traversal is often expressed recursively.Saving previously computed answers so repeated subproblems do not need to be solved again.
Example: Memoization turns naive recursive Fibonacci into a linear-time solution.A vertex is a point in a graph; an edge represents a connection between two points.
Example: Cities can be vertices and roads can be edges.A locally optimal decision made without revisiting earlier choices.
Example: Kruskal's algorithm repeatedly chooses the cheapest safe edge.Ready to see these ideas in motion?
Open Bubble Sort →