← Data Structures & Algorithms learning pathData Structures & Algorithms · Module 2 of 10
Complexity analysis
Measure algorithm efficiency with Big-O.
📖 Key ideas
- Big-O describes how running time grows with input size n.
- Common: O(1), O(log n), O(n), O(n log n), O(n²), O(2^n).
- Drop constants and lower-order terms.
- Space complexity measures memory.
- Analyse worst, average and best cases.
💡 Real-life example: Big-O is a speedometer for growth: how much slower does it get when the crowd doubles?
Big-OUpper bound on growth
O(1)Constant time
O(log n)Logarithmic time
Space complexityMemory growth