Course 16 · Craft

Algorithms
Why it is slow, and what to do.

Data structures and algorithms with the complexity measured rather than asserted: every lab counts its own operations and the page names the growth rate.

24Lessons
≈ 5hReading
24Playable now
ComplexitySortingSearchingTreesGraphs

0 of 24 lessons finished — nothing yet

The syllabus

24 lessons,
in the order they build on each other.

Start lesson one ↗
01

What Big-O measures

Growth, not speed — and the four things the notation deliberately throws away.

≈ 12 min
02

Measuring growth

Count the operations, fit the curve, and let the machine name the complexity.

≈ 13 min
03

Arrays

Contiguous memory: why the index is free, the insert is not, and the array still wins.

≈ 13 min
04

Linked lists

Nodes and pointers, the O(1) insert — and why the array usually beats it anyway.

≈ 13 min
05

Stacks and queues

Two disciplines, three implementations, and the ring buffer that makes a queue free.

≈ 12 min
06

Hash tables

Hashing, collisions and load factor — where "constant time" actually comes from.

≈ 14 min
07

Recursion

Base case, call stack, and the mechanical way to turn any recursion into a loop.

≈ 13 min
08

The simple sorts

Selection, bubble and insertion — measured, so you can see the n² for yourself.

≈ 13 min
09

Merge sort

Divide, conquer, merge: the first O(n log n), and the one that stays stable.

≈ 13 min
10

Quicksort

Partitioning in place, the pivot that matters, and the worst case nobody mentions.

≈ 14 min
11

Sorting in practice

What your language actually runs, sorting by a key, and why stability decides.

≈ 12 min
12

Binary search

Twelve lines that are wrong in four places — and the boundary form you actually need.

≈ 13 min
13

Two pointers and windows

The pattern that turns a nested loop into one pass over the data.

≈ 13 min
14

Trees

Terminology, the four traversals, and what recursion looks like on a shape.

≈ 12 min
15

Binary search trees

Search, insert, delete — and the input that turns the tree into a linked list.

≈ 13 min
16

Keeping a tree balanced

Rotations, the red-black idea, and why a database uses a B-tree instead.

≈ 13 min
17

Heaps and priority queues

An array that is secretly a tree: push, pop, heapify and the top-k pattern.

≈ 13 min
18

Tries

Prefix trees: autocomplete, spell-checking, and the space they cost.

≈ 12 min
19

Graphs

Adjacency list against matrix, directed and weighted — choosing the representation.

≈ 12 min
20

Breadth first, depth first

One queue, one stack, and the shortest path in an unweighted graph.

≈ 14 min
21

Shortest paths

Dijkstra with a heap, why negative weights break it, and what to use then.

≈ 13 min
22

Dynamic programming

Overlapping subproblems: memoise it, then turn it into a table.

≈ 15 min
23

Greedy and backtracking

When taking the best step works, when it does not, and how to search properly.

≈ 14 min
24

Practice: make it fast

One correct but unusable function. Find the complexity, then bring it down two orders.

≈ 16 min