Part 1:Definitions
T(n): The running time as a function on the input size n.
S(n): The used space as a function on the input size n.
Big-Oh(upper bound): ForT(n) a non-negatively valued function,T(n) is in the setO(f(n)), if there exist two positive constants c and n0such that T(n)≤cf(n) for alln>n0.
EX: If T(n)=3n2 then T(n) is in O(n2), and also in O(n3).
Big-Omega(lower bound): For T(n) a non-negatively valued function,T(n) isin the set Omega(g(n))if there exist two positive constants c andn0 such that T(n)≥cg(n) for alln> n0.
EX: T(n)=c1n2+c2n≥ c1n2 for all n >1. Therefore T(n)=Omega(n2) by the definition for c=c1 and n0=1.
Theta Notation: For T(n) a non-negatively valued funvtion, T(n)=Theta(h(n)) if T(n)=O(h(n)) and T(n)=Omega(h(n)).
Part 2: Simplifying Rules
Once you determine the running-time or used-space equation for an algorithm, you do not need to resort the formal definition of asmptotic analysis. Instead, you can use the following rules to determine the simplest form.
1. If f(n) is in O(g(n)), and g(n) is in O(h(n)), then f(n) is in O(h(n)).
2. If f(n)=O(g(n)) for any constant k > 0, then f(n)=O(g(n)).
NOTICE: These rules also hold true for Omega and Theta.