Skip to main content

Asymptotic Notation: Basics

AspectDefinitionSymbolFormal DefinitionRepresentationInterpretationCommon UseRelationship
Big O – Upper BoundRepresents the upper bound or worst-case scenario of a function. It denotes the maximum rate of growth of the functionO(f(n))O(f(n))

O(f(n))={g(n):there exist positive constantscandn0such that0g(n)cf(n)for alln>n0}O(f(n)) = \{g(n): \text{there exist positive constants} c \text{and} n_0 \text{such that} 0 \leq g(n) \leq c \cdot f(n) \text{for all} n > n_0 \}

Upper bound

It's like (<=) the function grows no faster than the specified function for large enough inputs

Analyzing worst-case time complexity of algorithmsO(f(n))O(f(n)) is a subset of Θ(f(n))\Theta(f(n))
Big Omega (Ω) – Lower BoundRepresents the lower bound or best-case scenario of a function. It denotes the minimum rate of growth of the functionΩ(f(n))\Omega(f(n))Ω(f(n))={g(n):there exist positive constantscandn0such that0cf(n)g(n)for alln>n0}\Omega(f(n)) = \{g(n): \text{there exist positive constants} c \text{and} n_0 \text{such that} 0 \leq c \cdot f(n) \leq g(n) \text{for all} n > n_0 \}Lower boundIt's like (>=) the function grows at least as fast as the specified function for large enough inputsAnalyzing best-case time complexity of algorithmsΩ(f(n))\Omega(f(n)) is a subset of Θ(f(n))\Theta(f(n))
Big Theta (Θ) – Tight BoundRepresents both upper and lower bounds of a function. It denotes the exact growth rate of the functionΘ(f(n))\Theta(f(n))

Θ(f(n))={g(n):there exist positive constantsc1,c2, andn0such that0c1f(n)g(n)c2f(n)for alln>n0}\Theta(f(n)) = \{g(n): \text{there exist positive constants} c_1, c_2 \text{, and} n_0 \text{such that} 0 \leq c_1 \cdot f(n) \leq g(n) \leq c_2 \cdot f(n) \text{for all} n > n_0 \}

Tight boundIt's like (==) the function grows at the same rate as the specified function for large enough inputsWhen both best-case and worst-case scenarios are identicalBoth O(f(n))O(f(n)) and Ω(f(n))\Omega(f(n)) are subsets of Θ(f(n))\Theta(f(n))