# Growth Order --- ## Growth Order - Treat functions that differ asymptotically by only a constant factor as roughly equivalent - Three different growth orders: - Big O, \\( O \\), upper bound - Big Theta, \\( \Theta \\), tight bound - Big Omega, \\( \Omega \\), lower bound --- ## Big O: Upper Bound - \\( O(g(n)) \\) denotes the set of functions that asymptotically grow no faster than \\( g(n) \\) - Mathematically, \\( f(n) \in O(g(n)) \\) if and only if there exists a constant \\( c \\) and a minimum value \\( n_0 \\) such that for all \\( n \geq n_0 \\), \\[ f(n) \leq c \cdot g(n) \\] - Or equivalently, \\( f(n) \in O(g(n)) \\) if and only if: \\[ \lim_{n \to \infty} \frac{f(n)}{g(n)} < \infty \\] --- ## Big Omega: Lower Bound - \\( \Omega(g(n)) \\) denotes the set of functions that asymptotically grow no more slowly than \\( g(n) \\). - Mathematically, \\( f(n) \in \Omega(g(n)) \\) if and only if there exists a constant \\( c \\) and a minimum value \\( n_0 \\) such that for all \\( n \geq n_0 \\), \\[ f(n) \geq c \cdot g(n) \\] - Or equivalently, \\( f(n) \in \Omega(g(n)) \\) if and only if: \\[ \lim_{n \to \infty} \frac{f(n)}{g(n)} > 0 \\] --- ## Big Theta: Tight Bound - \\( \Theta(g(n)) \\) denotes the set of functions that asymptotically grow at the same rate as \\( g(n) \\). If \\( f(n) \in O(g(n)) \\) and \\( f(n) \in \Omega(g(n)) \\), then \\( f(n) \in \Theta(g(n)) \\). - Mathematically, for some constant \\( c \\), where \\( 0 < c < \infty \\), \\( f(n) \in \Theta(g(n)) \\) if and only if: \\[ \lim_{n \to \infty} \frac{f(n)}{g(n)} = c \\] --- ## Summary \\[ O(c) \subsetneq O(\log(n)) \subsetneq O(n) \subsetneq O(n^2) \subsetneq O(n^3) \subsetneq O(2^n) \\] \\[ \Omega(2^n) \subsetneq \Omega(n^3) \subsetneq \Omega(n^2) \subsetneq \Omega(n) \subsetneq \Omega(\log(n)) \subsetneq \Omega(c) \\] \\[ \Theta(n^2) = \Theta(2n^2) = \Theta(2n^2 + 2n + 2) \\] \\[ \Theta(n) = \Theta(2n) = \Theta(2n + 2) \\]