Interactive course · 25 lessons · ~8 hours

Data structures & algorithms, in Python.

Not a list of LeetCode answers. Each lesson shows the structure drawn, explains what every operation costs and why, implements it in clean Python, and then teaches the pattern — so you recognise it in a problem you have never seen. All code in this course is executed and tested; the outputs shown are real.

0 of 25 lessons complete0%

The one idea this course is built on

Choosing a data structure is choosing which operations are cheap. The same problem can take a millisecond or a day depending on that choice.

Operations needed as the input grows work input size n → O(1) O(log n) O(n) O(n log n) O(n²) n = 1,000,000 items O(1) 1 O(log n) 20 O(n) 1,000,000 O(n log n) 20,000,000 O(n²) 1,000,000,000,000 At ~10⁷ simple Python operations per second, O(n²) here is ~28 hours. O(n log n) is ~2 seconds. Same question — "does this list contain duplicates?" — two answers Compare every pair: O(n²), 28 hours. Put each item in a set as you go: O(n), a tenth of a second. That is the whole course in one example.
Big-O is how fast the work grows, not how fast one run is. At small n everything feels fast; the difference only shows up at scale — which is exactly when it is too late to rewrite. Lesson 02 measures these curves on your own machine.

Pick a path

~3 hours

Coding interview in 2 weeks

Lessons 02, 03, 06, 09, 10, 13, 15, 17, 22, 24. The patterns behind most interview questions, in priority order.

~2 hours

I just want faster code

Lessons 02, 03, 05, 09, 11. Know what Python's built-ins cost and stop writing accidental O(n²).

~3 hours

Recursion and DP scare me

Lessons 04, 13, 20, 22, 23. Build intuition from the call stack up, one diagram at a time.

~8 hours

The full foundation

Go in order. Each lesson assumes the previous one, and the project uses nearly all of them.

Ships with a hands-on project

🛠 Build a route planner from scratch

A weighted road graph of 26 South Indian towns, Dijkstra and A* on your own binary heap, an LRU cache for repeated queries, trie-based autocomplete for place names and Kruskal to keep the map connected — all written by hand, and every piece tested against a slow reference (heapq, Floyd–Warshall, brute force).

Open the project →

The curriculum