Module 1
Big-O and Complexity
How to tell, before running anything, whether a solution will be fast enough, and how to read a problem's limits to know what speed it needs.
Every problem in this course is judged on two things: is it correct, and is it fast enough? Big-O is the language for "fast enough". It describes how the work grows as the input grows, so you can compare ideas on paper before writing code.
The most useful skill in this module is reading constraints: when a problem says n ≤ 10⁵, it's quietly telling you that O(n²) will be too slow and O(n log n) will pass.
Best after: Java for DSA
Part 1
Learn the ideas
- 1.1What Big-O MeasuresBig-O counts how the number of steps grows with the input size, ignoring constants and small terms, so you can compare algorithms without a stopwatch.15 min
- 1.2Growth Rates and Reading ConstraintsThe common complexity classes from fastest to slowest, and how the input limits in a problem tell you which ones will pass.15 min
- 1.3Space Complexity and the Call StackCounting the extra memory an algorithm uses, including the hidden memory of recursion.10 min
- 1.4Best, Worst, Average and Amortised CostWhy HashMap is "O(1) on average", why ArrayList.add is "O(1) amortised", and what those words really promise.12 min
Part 2
Solve the problems
In order of difficulty. Each one shows the pattern it teaches.
The simplest O(n) algorithm: one pass with one variable. Also why sorting first (O(n log n)) is wasted work.
The classic three-step speed-up: O(n²) all pairs → O(n log n) sort → O(n) hash set, and how to pick by constraints.