๐ 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
| Algorithm | What it's like | Complexity |
| Array access | Opening a book to page 42 โ you go straight there | O(1) โ instant |
| Binary Search | Guessing a number โ "higher or lower?" halves the options each time | O(log n) โ very fast |
| Linear Search | Looking for your name in an unsorted list โ check every single one | O(n) โ depends on size |
| Merge Sort | Split in half, sort each half, merge back together | O(n log n) โ fast |
| Bubble Sort | Sorting cards by swapping neighbours โ very slow on big lists | O(nยฒ) โ slow |
| Fibonacci (naive) | Recalculates the same thing over and over โ doubles the work each step | O(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.