Asymptotic Notation

B403: Introduction to Algorithm Design and Analysis

Θ Notation

Θ(g(n)) = {f(n) : ∃ pos. consts. c1, c2, and n0 such that
0 ≤ c1g(n) ≤ f(n) ≤ c2g(n) for all n ≥ n0}

Note:

  • Technically, f(n) ∈ Θ(g(n))
  • We also write f(n) = Θ(g(n))
  • Requires f(n) be asymptotically non-negative

O Notation

O(g(n)) = {f(n) : ∃ positive constants c and n0 such that
0 ≤ f(n) ≤ cg(n) for all n ≥ n0}

Note:

  • Technically, f(n) ∈ O(g(n))
  • We also write f(n) = O(g(n))
  • Θ(g(n)) ⊆ O(g(n))
  • Does not imply tight bound
Two other asymptotic notations used in the textbook are o(n) and ω(n). Their definition closely follows the others we have seen here, and are left for you as an exercise to read from the textbook.

Ω Notation

Ω(g(n)) = {f(n) : ∃ positive constants c and n0 such that
0 ≤ cg(n) ≤ f(n) for all n ≥ n0}

Note:

  • Technically, f(n) ∈ Ω(g(n))
  • We also write f(n) = Ω(g(n))
  • Θ(g(n)) ⊆ Ω(g(n))
  • Does not imply tight bound

Theorem

For any two functions f(n) and g(n), we have f(n) = &Theta(g(n)) if and only if f(n) = O(g(n)) and f(n) = Ω(g(n)).

Proof?

Terms

  • Comparing asymptotic functions
    • Transitivity
    • Reflexivity
    • Symmetry
  • Monotonicity
  • Number properties
    • Floors and ceilings
    • Modular arithmetic
    • Polynomials
    • Exponentials
    • Logarithms
    • Factorials
    • Fibonacci numbers
  • Functional iteration