Topic2-Asymptotic Analysis
Topic2-Asymptotic Analysis
Asymptotic Analysis
General Property:
Transitive Properties:
Example:
Reflexive Properties:
Symmetric Properties:
If 𝑓(𝑛) is Θ(𝑔(𝑛)) then 𝑔(𝑛) is Θ(𝑓(𝑛)).
Example:
If 𝑓(𝑛) = 𝑛² and 𝑔 𝑛 = 4 ∗ 𝑛²
then, 𝑓(𝑛) = Θ(𝑛²) and 𝑔(𝑛) = Θ(𝑛²)
Example:
If 𝑓(𝑛) = 𝑛 , 𝑔(𝑛) = 𝑛²
Example:
There are two more notations called Little 𝒐 and Little Omega
(ω).
We say that 𝑓(𝑛) is 𝜔(𝑔(𝑛)) (or 𝑓(𝑛) ∈ 𝜔(𝑔(𝑛))) if for any real
constant 𝑐 > 0,
The relationship between Big Omega (Ω) and Little Omega (ω)
is similar to that of Big-Ο and Little o
• except that in case of Big Omega (Ω) and Little Omega (ω)
we look at the lower bounds.
Asymptotic Notation (Little Omega (ω)-Notation)
Contd..
Example:
func( )
{
int i, n;
for (i=1; i<=n; i++)
printf(“ABC”);
}
func( )
{
int i, j, n;
for (i=1; i<=n; i++)
{
for (j=1; j<=n; j++)
printf(“ABC");
}
}
Time Complexity
Contd..
In this case, firstly, the outer loop will run 𝒏 times, such that for
each time, the inner loop will also run 𝒏 times.