← Data Structures & Algorithms learning path
Data Structures & Algorithms · Module 2 of 10

Complexity analysis

Measure algorithm efficiency with Big-O.

📖 Key ideas

  1. Big-O describes how running time grows with input size n.
  2. Common: O(1), O(log n), O(n), O(n log n), O(n²), O(2^n).
  3. Drop constants and lower-order terms.
  4. Space complexity measures memory.
  5. 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