Lec-4&5 Asymptotic Notations
Lec-4&5 Asymptotic Notations
(BCAE0106)
Presented by:
Akanksha
Assistant Professor
Dept. of Computer Engineering & Applications, IET,
GLA University, Mathura
Outline
Need of Asymptotic Notations
Asymptotic Notations
Big O Notation
Omega Notation
Theta Notation
Little O Notation
Little Omega Notation
Conclusion
Need of Asymptotic Notations:
Asymptotic Notations are abstract notations for
describing the behaviour of the algorithm and
determine the rate of growth of a function.
3
Asymptotic Notation
Asymptotic Notations are mathematical tools
to represent the time complexity of algorithms
for asymptotic analysis.
Running time
constants c > 0 and n0 ≥ 1 ,
s.t. 0 ≤ f(n) ≤ c g(n) for n ≥ n0
10
Examples on Big Oh Notation:
Example 2:
Given f(n) = 2n2+n , then prove that
f(n)=O(n2)
The Big-Omega (Ω) Notation
Running time
constants c > 0 and n0 ≥ 1 ,
s.t. 0 ≤ c g(n) ≤ f(n) for n ≥ n0
On solving the inequality we find that when Case 1:C=1 and n=1 i.e.
1(1) 3(1) +5
1 8 (True)
Running time
for n ≥ n0
The above definition means,
if f(n) is theta of g(n),then the
value of f(n) is always between
c1.g(n) and c2.g(n) for large values
of n (n>= n0)
f(n) and g(n) are functions
over non-negative integers. Input size
Examples of Theta Notation:
Example 1: f(n)= n2 +3n+7, then prove that f(n)= Θ( n2 )
Solution 1. As per def.: C1.g (n) f (n) C2.g (n)
For the given problem statement, f(n)= n2 +3n+7, g(n)=n2
Now there exists a constants such that value of c>0 and n 1
As per Big-Theta theory C1.g (n) f(n) C2.g(n)
C1. n2 n2 +3n+7 C2. n2
If C1=1 & C2=2 then n>=5
Hence,
17
Asymptotic Notation
The Little-oh (o) Notation
Asymptotic upper bound
Running time
f(n)=o(g(n)) , if there exists
constants c > 0 and n0 ≥ 1 ,
s.t. 0 ≤ f(n) < c g(n) for n ≥ n0
f(n) and g(n) are functions
over non-negative integers.
Input size
Asymptotic Notation
The Little-omega (Ω) Notation
Asymptotic lower bound
Running time
f(n)= Ω(g(n)) , if there exists
constants c > 0 and n0 ≥ 1 ,
s.t. f(n) > c g(n) ≥ 0 for n ≥ n0
f(n) and g(n) are functions
over non-negative integers.
Input size
Analogy of Asymptotic Notations with
real numbers
f(n) is O((g(n)) a <= b
f(n) is Ω((g(n)) a >= b
f(n) is Θ((g(n)) a=b
f(n) is o((g(n)) a<b
f(n) is ω((g(n)) a>b
Conclusion
Most useful notation is Theta, followed by Big
O.