Back to the 2023 paper

Module 1: Introduction

20237m

Explain the concept of asymptotic notation (Big O, Big Omega, and Big Theta) in algorithm analysis.

Worked SolutionAI Assisted

Asymptotic Notations — OO, Ω\Omega, Θ\Theta

Asymptotic notation describes growth of T(n)T(n) for large nn, ignoring constants and lower-order terms.

1. Big O — Upper bound (≤\le)

O(g(n))={f(n):∃c>0,n0>0,0≤f(n)≤c g(n)  ∀n≥n0}O(g(n)) = \{ f(n): \exists c>0, n_0>0, 0 \le f(n) \le c\,g(n) \;\forall n \ge n_0 \}
Example: 3n2+5n+2=O(n2)3n^2+5n+2 = O(n^2) (choose c=4c=4, n0=10n_0=10). Means algorithm at most that fast-growing.

2. Big Omega — Lower bound (≥\ge)

Ω(g(n))={f(n):∃c>0,n0>0,0≤c g(n)≤f(n)  ∀n≥n0}\Omega(g(n)) = \{ f(n): \exists c>0, n_0>0, 0 \le c\,g(n) \le f(n) \;\forall n \ge n_0 \}
Example: n2/2−n=Ω(n2)n^2/2 - n = \Omega(n^2). Means algorithm at least that slow.

3. Big Theta — Tight bound (==)

Θ(g(n))={f(n):∃c1,c2>0,n0>0,c1g(n)≤f(n)≤c2g(n)  ∀n≥n0}\Theta(g(n)) = \{ f(n): \exists c_1,c_2>0, n_0>0, c_1 g(n) \le f(n) \le c_2 g(n) \;\forall n \ge n_0 \}
Equivalently f(n)=Θ(g(n))  ⟺  f(n)=O(g(n))f(n)=\Theta(g(n)) \iff f(n)=O(g(n)) and f(n)=Ω(g(n))f(n)=\Omega(g(n)).
Example: 3n2+5n=Θ(n2)3n^2+5n = \Theta(n^2).

Small o / small omega (strict)

  • o(g)o(g): ∀c>0\forall c>0 eventually f(n)<cg(n)f(n) < c g(n) (non-tight upper).
  • ω(g)\omega(g): strict lower.

Properties & Use

  • Transitivity, reflexivity, symmetry (Θ\Theta symmetric).
  • Transpose: f=O(g)  ⟺  g=Ω(f)f=O(g) \iff g=\Omega(f).
  • Used to classify algorithms: Linear search O(n)O(n) worst, Ω(1)\Omega(1) best, Θ(n)\Theta(n) average; Merge sort Θ(nlog⁡n)\Theta(n\log n); Binary search Θ(log⁡n)\Theta(\log n).
  • Hierarchy: O(1)⊂O(log⁡n)⊂O(n)⊂O(nlog⁡n)⊂O(n2)⊂O(2n)O(1) \subset O(\log n) \subset O(n) \subset O(n\log n) \subset O(n^2) \subset O(2^n).

Graphical intuition

Plot c⋅g(n)c\cdot g(n) bounding f(n)f(n) above (OO), below (Ω\Omega), or sandwiching (Θ\Theta) beyond n0n_0.

Similar questions

Official AppAndroid App

PYQDeck for Android

Solve BEU previous-year exam papers anywhere, anytime. Fast search, offline paper viewing, and step-by-step solutions designed specifically for your phone.