๐Ÿ“ˆ Big O Notation

See how different time complexities scale. Drag the slider to increase input size and watch some algorithms explode while others stay calm.

Designed with the WJEC specification in mind
CS A-Level Unit 3CS GCSE ยง1.4
โš™๏ธ

Select complexities to compare

5
๐Ÿ“Š

Growth Chart

๐Ÿ”ข

Operations at n = 5

ComplexityOperationsIf 1ฮผs eachVerdict
๐Ÿ’ก

Real Algorithm Examples

AlgorithmWhat it's likeComplexity
Array accessOpening a book to page 42 โ€” you go straight thereO(1) โ€” instant
Binary SearchGuessing a number โ€” "higher or lower?" halves the options each timeO(log n) โ€” very fast
Linear SearchLooking for your name in an unsorted list โ€” check every single oneO(n) โ€” depends on size
Merge SortSplit in half, sort each half, merge back togetherO(n log n) โ€” fast
Bubble SortSorting cards by swapping neighbours โ€” very slow on big listsO(nยฒ) โ€” slow
Fibonacci (naive)Recalculates the same thing over and over โ€” doubles the work each stepO(2โฟ) โ€” impossibly slow
๐Ÿ’ก Helpful hint โ€” what does "log" mean?
log n is the number of times you can halve n before you reach 1.
For example: logโ‚‚(8) = 3, because 8 โ†’ 4 โ†’ 2 โ†’ 1 (halved 3 times).
logโ‚‚(1000) โ‰ˆ 10 โ€” so even with 1,000 items, you only need about 10 steps!
That's why O(log n) is so fast โ€” and why binary search beats linear search on large lists.