Stage 1 · Lesson 1 of 6
What Big-O means and the common growth rates
describes how much more work code does as its input gets bigger. This is called its time complexity. It keeps only the part that grows fastest and ignores fixed multipliers, so 3n² + 5n + 20 is simply O(n²).
Learn the in order, with the kind of code behind each. O(1) takes the same few steps whatever the input. O(log n) cuts the problem in half at each step.
O(n) looks at every item once. O(n log n) is what good sorting costs. O(n²) compares every pair of items.
O(2^n) checks every possible . The gaps are huge: for a million items, O(n log n) is about 20 million steps, while O(n²) is a trillion.
A question to check yourself, an AI practice session and 2 cheat sheet entries come with the full roadmap. Unlock
Resources for this stage
Start with· follow one of these
- CoursePaidGrokking Algorithm Complexity and Big-O
Design Gurus · Beginner · Subscription
Short course on exactly this stage, including the amortised and space cases people miss
- CourseFreeAlgorithms, Part I
Princeton University · Intermediate
Free: the Analysis of Algorithms module measures real Java programs, then models their cost
Keep handy
Also worth your time
Time and space complexity worked through five common algorithms