← all subjects

Algorithms

Algorithms are how you turn “a computer could do this” into “here is exactly how, and here is why it’s fast.” It is the difference between a program that works on your laptop and one that works at scale.

FIG_002
2ⁿn log nn
Why cost matters: n, n·log n, n², 2ⁿ.

Correctness comes first. Before you ask whether an algorithm is fast, you ask whether it is right — an invariant that holds at every step, a base case that grounds the recursion, an argument that the loop must end.

The core skill is then reasoning about cost before you write a line of code. Asymptotic analysis lets you compare strategies on paper and predict which survives a million inputs and which falls over at a thousand.

FIG_003
ANITTAAMITTAI00000000111111011111101122220112333011234401123450112345
Dynamic programming: an LCS table, filled cell by cell.

Big-O strips away the constants and the hardware to leave the one thing that matters at scale: how the work grows as the input does. A linear pass and a quadratic one feel identical on ten items and worlds apart on ten million.

Most hard problems yield to a handful of ideas — divide & conquer, greedy choices, dynamic programming, and well-chosen data structures. Learn the ideas once and you start to recognize them everywhere.

FIG_001
SGexploredfrontierpathwallS start · G goal[ A* SEARCH ]
A* search: a heuristic steers the frontier toward the goal, then traces the shortest path.
FIG_004
ST
Model it as a graph and search.

Data structures are the other half of the story. The right one — a heap, a hash table, a balanced tree, a union-find — turns an expensive operation into a cheap one, and a sluggish program into an instant one.

FIG_005
449624721210856
Sorting: from jumbled to ordered, one comparison at a time.

And when a problem is genuinely intractable, you learn to prove it — so you stop hunting for an efficient algorithm that cannot exist, and start designing approximations that can.

This is the subject that makes you dangerous: it teaches you to find a good solution, justify it, and know when no better one is possible.

Contents.

·
Progress.░░░░░░░░░░░░░░░░░░
Articles done:0 / 57
Complete:0%
Notes written:0
Highlights:0

***

| STUDY · NOTES |

A reference for the ideas behind computer science.

Written and illustrated by Amittai Siavava.

| § 2026 |