Complexity and Big O
Big O describes how work grows as the input grows. It is not a stopwatch, it is a shape, and knowing the common shapes tells you which code will still be fine when the data is a hundred times bigger.
What you'll learn
12 chapters, then the quiz
- 01Why complexity mattersTiming one run tells you almost nothing.
- 02Reading Big ODrop the constants, keep the fastest growing term.
- 03Constant and linear timeO(1) and O(n), the two you meet most.
- 04Logarithmic timeHalving the problem each step.
- 05Sorting and its floorWhy O(n log n) is the wall.
- 06Quadratic and worseNested loops, and when they are acceptable.
- 07Best, average and worstOne algorithm, three answers.
- 08Space complexityMemory grows too.
- 09Amortised analysisRare expensive steps, spread out.
- 10Costs by data structureA table worth remembering.
- 11Recursion and recurrencesWorking out the cost of a divide and conquer.
- 12Choosing an algorithmWhen the notation is not the answer.
More programming tests
See all →- Easy
JavaScript fundamentals
Types, scope and the small surprises the language is famous for.
8 questions6 min - Easy
Python essentials
Syntax, built-in types and the everyday behaviour of the standard library.
8 questions6 min - Medium
Git in practice
The commands you reach for on a normal working day.
7 questions5 min