- Tutorials
- DSA Tutorial
- Big O and Complexity
Big O and Complexity
2 lessonsAbout 12 minutesBeginner
This part of the DSA Tutorial runs from Big O Notation Explained through to Time vs Space Complexity. There are 2 lessons here, and working through them takes about 12 minutes at a steady pace.
It follows on from DSA Introduction, so finish that first if you have not already — the examples below assume you are comfortable with it.
Each lesson below says what it covers before you open it. Read them in order the first time; afterwards this page works as a index you can jump back into when you need to check one thing.
- 1Big O Notation ExplainedBig O describes how an algorithm slows down as input grows, not how many milliseconds it takes. Learn to read O(1), O(n), O(n log n) and O(n²) from JavaScript code.
- 2Time vs Space ComplexityTime complexity counts operations; space complexity counts memory. Learn to measure both in JavaScript and recognise when trading one for the other is worth it.
