Data Structures & Algorithms · Revision notes

Asymptotic Analysis & Complexity

Asymptotic analysis measures how running time and memory grow with input size n, ignoring machine-specific constants. Big-O (upper bound), Omega (lower bound) and Theta (tight bound) are the language of every algorithm comparison; recursion adds call-stack space.

Quick revision

  • Order :1<logn<sqrtn<n<nlogn<n2<n3<2n<n!<nn\text{Order}\ : 1 < log n < sqrt n < n < n log n < n^2 < n^3 < 2^n < n! < n^n
  • Theta = O and Omega; drop constants and lower terms
  • Sequential: add (max); nested: multiply; halving/doubling: log
  • Master: compare n^(log_b a) with f(n)
  • Space = auxiliary + recursion depth; naive Fibonacci time 2^n, stack n
Read the full Asymptotic Analysis & Complexity notes on Doubtclip →