Begin Algo
Topic-based curriculum

One topic at a time, until the algorithms actually stick.

Each topic is a group of related algorithms. Every lesson has the same shape: the concept, the steps, a demo you can press through yourself, the code, and problems to practise on.

17topics
93algorithms
93lessons written
0you have learned

Data structures

7 topics · 29 lessons
FoundationsHow we measure cost · 3 lessons

How to judge whether an algorithm is any good. The vocabulary the rest of the site uses.

Used for:Why it was fast in testing and times out in production, Why pushing to a dynamic array counts as O(1), Handing the problem to a smaller version of yourself

Big-O NotationRecursionAmortized Analysis
0/3
Array & HashingIndexed and keyed access · 5 lessons

The two most basic containers: reach things by position, or by key.

Used for:Caches and sessions, "How many times does this letter appear?", Range totals in a report, Images and game boards

Array & Dynamic ArrayPrefix SumHash TableHash Set / Map Patterns+1
0/5
Linked ListNodes joined by pointers · 5 lessons

Nodes strung together by pointers. O(1) insert and delete, but no jumping straight to an index.

Used for:Back and forward in a browser, LRU caches, Detecting a cycle

Singly Linked ListDoubly Linked ListReverse Linked ListFast & Slow Pointers+1
0/5
Stack & QueueLast in first out, first in first out · 4 lessons

Order is itself information.

Used for:Bracket matching and undo in an editor, Print spoolers and message queues, "When is the next day the price is higher?", Window maximum on a dashboard

StackQueue & DequeMonotonic StackMonotonic Queue
0/4
Heap / Priority QueueAlways the largest or smallest, in O(log n) · 3 lessons

Get at the maximum or minimum whenever you want, for O(log n).

Used for:OS process scheduling, Top 10 most-read articles, A running median

Binary HeapTop-K ProblemsTwo Heaps
0/3
TreeHierarchies without cycles · 7 lessons

Hierarchy without cycles. Recursion feels most natural here.

Used for:File systems and the DOM, Database indexes and sorted sets, Autocomplete in a search box, Live rankings and range statistics

Binary Tree BasicsTraversalBSTBalanced BST+3
0/7
Graph RepresentationStoring a graph, and answering "connected?" · 2 lessons

How to store a graph in code, and how to answer "are these two connected?" quickly.

Used for:Friendships in a social network, Is the network still connected?, Grouping faces in a photo library

Adjacency List / MatrixUnion-Find
0/2

Algorithms

10 topics · 64 lessons
SortingFrom O(n²) to O(n log n) · 9 lessons

Putting things in order. From O(n²) to O(n log n), and where the comparison barrier sits.

Used for:Storefronts and leaderboards, ORDER BY and external sorting, Sorting as a prerequisite, When the values are plain integers

Bubble SortSelection SortInsertion SortMerge Sort+5
0/9
Searching & Two PointersHalving the search space · 5 lessons

Finding things. Order lets you throw away half the data at every step.

Used for:git bisect finding the broken commit, "How fast do we have to go to make it?", "Average over the last 5 minutes", Two numbers summing to a target

Linear SearchBinary SearchBinary Search on AnswerTwo Pointers+1
0/5
Recursion & BacktrackingTry everything, but turn back early · 5 lessons

Try every possibility, but turn back the moment it cannot work.

Used for:Timetabling and seating, Enumerating combinations, Sudoku and crosswords

SubsetsPermutationsCombinations & Combination SumN-Queens+1
0/5
Divide & ConquerSplit, solve, combine · 4 lessons

Cut it into pieces, solve each, then put the answers back together.

Used for:Why halving makes it faster, Cryptography and big numbers, "How many pairs are out of order?"

Master TheoremMaximum SubarrayFast ExponentiationCount Inversions
0/4
GreedyTake the best step available, now · 5 lessons

Always take the best option available right now. When does that give the best overall answer?

Used for:Meeting rooms and timetables, Compression in zip and JPEG, Making change and OS scheduling, Can you reach the end?

Greedy PrinciplesCoin Change (Greedy)Interval SchedulingJump Game+1
0/5
Graph AlgorithmsTraversal, shortest paths, ordering · 11 lessons

Start with traversal, then shortest paths, dependency order and connectivity.

Used for:Map navigation, "People you may know", Install and build order, Laying network cable

BFSDFSGrid as GraphCycle Detection+7
0/11
Dynamic ProgrammingOverlapping subproblems, remembered · 11 lessons

Break a big problem into overlapping smaller ones, and remember the answers so you never recompute.

Used for:Spell check and autocorrect, git diff, Budgets and resource allocation, Why plain recursion is not enough

Memoization & Tabulation1-D DP0/1 KnapsackUnbounded Knapsack+7
0/11
String AlgorithmsMatching, searching and hashing · 6 lessons

Matching, searching and hashing. The prefix function is the key tool here.

Used for:Ctrl+F and grep, Plagiarism and duplicate detection, DNA sequence analysis, Matching thousands of keywords at once

String HashingRabin-KarpKMPZ-Algorithm+2
0/6
Bit ManipulationWorking directly with ones and zeroes · 4 lessons

Work on the ones and zeroes directly. Fast, compact, and a way to represent sets.

Used for:Permissions and feature flags, Finding the one that is alone, Netmasks and hashing

Bitwise BasicsXOR TricksCounting BitsSubset Enumeration
0/4
Math & Number TheoryThe maths that keeps coming up · 4 lessons

The handful of mathematical tools that algorithm problems keep reaching for.

Used for:RSA behind HTTPS, Aspect ratios and reducing fractions, "How many ways are there?"

GCD & LCMSieve of EratosthenesModular ArithmeticCombinatorics
0/4