State · invariant · frontier · correctness · cost

Algorithms

An algorithm is a precise process for transforming state. First choose the problem family; then study the representation, legal transitions, proof of correctness, termination, and resource growth.

Primary navigation · direct children

Choose the structure of the problem before choosing a technique.

The six destinations remain peers in the curriculum. This atlas groups them only by the kind of question they ask: transforming or exploring state on the left, designing and evaluating procedures on the right.

Parent hubComputer Science
01RepresentChoose the state that exposes useful moves.
02AdvanceDefine one legal transition at a time.
03ProveTrack an invariant and termination measure.
04MeasureCount time and memory under an input model.
01Frontier disciplineOne graph, two worklist rules
Widget 01 · graph traversal

The graph stays fixed. The frontier rule changes the route.

Breadth-first search removes the oldest discovered node from a queue. Depth-first search removes the newest discovered node from a stack. Both avoid cycles by recording discovery before expansion.

Traversal invariant

Every node enters the frontier at most once. The frontier contains discovered work that has not yet been expanded.

ABCDEFG
Frontier
A
Visited order
none
Graph cost
O(V + E)
Frontier controls
Current discipline

Queue: expand the earliest discovered node first. This finds minimum-edge paths in an unweighted graph.

02Local exchangeA sequence becomes ordered through repeated comparisons
Widget 02 · sorting conveyor

Repeated local comparisons can build a global order.

Bubble sort is deliberately simple rather than efficient. Each pass compares neighboring values and pushes the largest remaining value into the sorted suffix.

Machine state
pass 1 · compare 1
7
0
2
1
9
2
4
3
1
4
8
5
3
6
6
7
Comparisons
0
Swaps
0
Worst case
O(n²)
Loop invariant

After pass k, the k largest values occupy their final positions at the right edge. The unsorted prefix shrinks as the invariant grows.

Conveyor controls

The highlighted pair is the only local comparison happening now. The green suffix has already reached its final order.

03Resource growthAbsolute operation counts on an honest linear axis
Widget 03 · complexity observatory

A linear axis lets absolute growth separate honestly.

The vertical axis below is a direct toy operation count, not a logarithmic transformation. Smaller families will hug the baseline when quadratic growth dominates, which is precisely the relationship the chart is meant to reveal.

Separation at n = 32
6.4×

O(n²) performs about 6.4 times as many toy operations as O(n log n) at this input size.

01,0242,0483,0724,096216324864input size ntoy operations · linear scale
Reading the baseline: O(1), O(log n), and O(n) remain small relative to 4,096. Exact values stay visible in the comparison ledger rather than being visually exaggerated by a transformed axis.
Input and family
Selected family
O(n²)1,024 operations

Big O describes a family of growth under a stated input and operation model. It is not an exact stopwatch prediction.

Evaluation criteria · reference, not navigation

Three questions follow every algorithm into deeper pages.

no destinations in this band
Correctness

Does it do what it claims?

Examples build intuition, but invariants, induction, exchange arguments, and contradiction explain why every valid input is handled correctly.

Efficiency

How does cost scale?

Time and space depend on input size, representation, assumptions, and which operations are counted. Big O summarizes growth, not exact seconds.

Representation

What state makes the next move cheap?

The same problem changes when information is stored as an array, tree, graph, heap, hash table, or stream.