Chapter 3: Growth Functions

December 11, 2020

Thomas H. Cormen, Charles E. Leiserson, Ronald Rivest, Clifford Stein. Introduction to Algorithms, Second Edition. The MIT Press, 2001

The basics of proving and comparing computational runtimes.

3.1 Asymptotic Notation

Θ\Theta-notation:

Big theta is an asymptotically tight bound.

Θ(g(n))\Theta(g(n)) = {f(n)\{f(n) : there exist positive constants c1c_1, c2c_2, and n0n_0 such that 0c1g(n)f(n)c2g(n)0 \leq c_1g(n) \leq f(n) \leq c_2g(n) for all nn0}n \geq n_0\}

Introduction to Algorithms Second Edition, page 42

OO-notation:

Big O is an asymptotic upper bound, a.k.a. the worst-case running time.

O(g(n))O(g(n)) = {f(n)\{f(n) : there exist positive constants cc and n0n_0 such that 0f(n)cg(n)0 \leq f(n) \leq cg(n) for all nn0}n \geq n_0\}

Introduction to Algorithms Second Edition, page 44

Ω\Omega-notation:

Big omega is an asymptotic lower bound, a.k.a. the best-case running time.

Ω(g(n))\Omega(g(n)) = {f(n)\{f(n) : there exist positive constants cc and n0n_0 such that 0cg(n)f(n)0 \leq cg(n) \leq f(n) for all nn0}n \geq n_0\}.

Introduction to Algorithms Second Edition, page 45

Theorem 3.1

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

Introduction to Algorithms Second Edition, page 46

3.2 Standard Notations and Common Functions

A function f(n)f(n) is monotonically increasing if mnm \leq n implies f(m)f(n)f(m) \leq f(n). Similarly, it is monotonically decreasing if mnm \leq n implies f(m)f(n)f(m) \geq f(n). A function f(n)f(n) is strictly increasing if m<nm \lt n implies f(m)<f(n)f(m) \lt f(n) and strictly decreasing if m<nm \lt n implies f(m)>f(n)f(m) \gt f(n).

Introduction to Algorithms Second Edition, page 51

Exponential Identities:

(am)n=amn(a^m)^n = a^{mn}

(am)n=(an)m(a^m)^n = (a^n)^m

aman=am+na^ma^n = a^{m+n}

Introduction to Algorithms Second Edition, page 52

Logarithmic Identities:

For all real a>0a \gt 0, b>0b \gt 0, c>0c \gt 0, and nn,

a=blogbaa = b^{log_ba}

logc(ab)=logca+logcblog_c(ab) = log_ca + log_cb

logban=nlogbalog_ba^n = nlog_ba

logba=logcalogcblog_ba = \frac{log_ca}{log_cb}

logb(1/a)=logbalog_b(1/a) = -log_ba

logba=1logablog_ba = \frac{1}{log_ab}

alogbc=clogbaa^{log_bc} = c^{log_ba}

Introduction to Algorithms Second Edition, page 53

Fibonacci Numbers:

e.g. 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, \dots

The closed form, based on the golden ratio:

ϕ=1+52\phi = \frac{1 + \sqrt5}{2}

and its inverse:

ϕ^=152\hat\phi = \frac{1 - \sqrt5}{2}

is:

Fi=ϕiϕ^i5F_i = \frac{\phi^i - \hat\phi^i}{\sqrt5}

Introduction to Algorithms Second Edition, page 56