Asymptotic Notations
Last updated
Last updated
There are 3 main asymptotic notations to denote time complexity:
Big-O (O)
Big-Omega ()
Big-Theta ()
We also have little-o (o) and little-omega ()
Big-O is the most commonly used notation. It denotes the worst-case time complexity.
We say f(n) = O(g(n)) iff there exists some constant c>0, and such that f(n) <= c.g(n) for all n >=
g(n) will be the upper-bound for f(n).
We say f(n) = (g(n)) iff there exists some constant c>0, and such that f(n) >= c.g(n) for all n >=
g(n) will be the lower-bound for f(n).
We say f(n) = (g(n)) iff there exist some constants c and c, and such that c.g(n) <= f(n) <= c.g(n) for all n >=
We say f(n) = o(g(n)) iff f(n) < c.g(n) for any c>0.
f is dominated by g asymptotically.
g is dominated by f asymptotically.
Note the following relation between different n terms:
g(n) will be both the upper and lower bound for f(n), for certain constants c and c.
We say f(n) = (g(n)) iff f(n) > c.g(n) for any c>0.