// lessons
Lessons
Algorithms and data structures in learning order. Each lesson steps through real code, line by line.
01
Big-O: measuring growth
free02
Arrays and hash maps
free03
Sorting basics
free04
Two pointers and sliding window
free05
Stacks, queues and linked lists
free- data structurefree
Stack
A last-in, first-out collection: you only ever touch the top.
- time
- O(1)
- space
- O(n)
- data structurefree
Queue
A first-in, first-out collection: add at the back, remove from the front.
- time
- O(1)
- space
- O(n)
- algorithmfree
Reverse a linked list
Flip every next pointer in place, using three pointers: prev, curr and nxt.
- time
- O(n)
- space
- O(1)
06
Recursion
pro07
Binary search
pro08
Trees: BFS and DFS
pro09
Dynamic programming
pro- algorithmpro
Dynamic programming: climbing stairs
Count the ways up a staircase taking 1 or 2 steps at a time, by building on smaller answers.
- time
- O(n)
- space
- O(n)
- algorithmpro
Dynamic programming: coin change
Find the fewest coins that make an amount, a problem where grabbing the biggest coin first fails.
- time
- O(n·m)
- space
- O(n)
- algorithmpro
Dynamic programming: grid paths
Count the paths across a grid that only move right or down.
- time
- O(n·m)
- space
- O(n·m)