1. What is Big-O notation and why does it matter?
EasyData structures & algorithms
Technical
Show model answer
Big-O describes how an algorithm's running time or memory grows as the input grows, ignoring constant factors. O(n) grows linearly, O(n²) quadratically, O(log n) very slowly.
It matters because it predicts behaviour at scale: an O(n²) loop that is fine for 100 items can be unusable for a million. In interviews, state the time and space complexity of every solution you propose.
What interviewers listen for
- Worst case vs average case
- Drop constants and lower-order terms
- Mention space as well as time