You are on page 1of 15

Asymptotic Notations (( O, Ω, Θ), (o, ω))

Asymptotic notations are mathematical tools to represent the time


complexity of algorithms for asymptotic analysis, that don’t depend
on machine-specific constants and don’t require algorithms to be
implemented.
1. Big-O:-

If f(n) is O(g(n)) then c*f(n) is also O(g(n)) ;


where c is a constant.
Example: f(n) = 2n²+5 is O(n²).
For example, consider the case of Insertion Sort. It takes linear time
in the best case and quadratic time in the worst case.
We can safely say that the time complexity of Insertion sort is
O(n^2).
Note that O(n^2) also covers linear time.

If we use Θ notation to represent time complexity of Insertion sort,


we have to use two statements for best and worst cases:
1. The worst-case time complexity of Insertion Sort is Θ(n^2).
2. The best case time complexity of Insertion Sort is Θ(n).
The Big O notation is useful when we only have an upper bound on
the time complexity of an algorithm. Many times we easily find an
upper bound by simply looking at the algorithm.
2. Ω Notation: Just as Big O notation provides an asymptotic upper
bound on a function, Ω notation provides an asymptotic lower bound.
➢ Omega notation is the least used notation among all three.
➢Ω Notation can be useful when we have a lower bound on the time
complexity of an algorithm.
3. Θ Notation: It defines exact asymptotic behaviour.
A simple way to get the Theta notation of an expression is to drop
low-order terms and ignore leading constants. For example, consider
the following expression:- 3n3 + 6n2 + 6000 = Θ(n3) ,
Little ο asymptotic notation
Little o notation is used to describe an upper bound that cannot be
tight. In other words, loose upper bound of f(n).
“Little-ο” (ο()) notation is used to describe an upper-bound that cannot be tight.

Thus, little o() means loose upper-bound of f(n). Little o is a rough estimate of
the maximum order of growth whereas Big-Ο may be the actual order of
growth.
Mathematical Relation of Little o notation:- f(n) = o(g(n)) means,

For example-1:-
If f(n) = n2 and g(n) = n3 then check whether f(n) = o(g(n)) or not.
Example-2: Is 7n + 8 ∈ o(n2)? (Apply the L’hospital rule)
Little ω asymptotic notation

Little Omega (ω) is a rough estimate of the order of the growth


whereas Big Omega (Ω) may represent exact order of growth. We
use ω notation to denote a lower bound that is not asymptotically
tight.
Mathematical Relation of Little o notation:- f(n) = ω(g(n)) means,
lim f(n)/g(n) = ∞
n→∞

Example:
Prove that 4n + 6 ∈ ω(1);
if lim f(n)/g(n) = ∞ then functions f(n) is ω(g(n))
n→∞ here, we have functions f(n)=4n+6 and g(n)=1
lim (4n+6)/(1) = ∞
n→∞
DIVIDE-AND-CONQUER
The complexity of many divide-and-conquer algorithms
is given by recurrences of the form
Finally, we can write using O is O(n.log n).
▪ The advantage of DAndC is to achieve Parallelism.

• Divide-and-conquer algorithms are naturally adapted for execution in


multi-processor machines.

• It is very natural to first describe these algorithms using recursion.

You might also like