juniorOptimisation
What is time complexity and why is it important?
Updated May 17, 2026
Short answer
Time complexity measures how execution time grows with input size.
Deep explanation
It helps compare algorithms independently of hardware. Big-O notation expresses worst-case growth, helping developers choose scalable solutions.
Real-world example
Choosing O(n log n) sorting over O(n²) in large datasets.
Common mistakes
- Ignoring worst-case scenarios and focusing only on average case.
Follow-up questions
- What is Big-O notation?
- Why is worst-case important?