2. Data Structures Asymptotic Analysis
• The algorithm takes less time or space
Best Case
• The algorithm takes long time or space.
Worst Case
• The algorithm takes time or space that lies between
best and worst case.
Average Case
V.G.Jyothi Mani
2
Asymptotic Notations are the expressions that are used to represent the
complexity of an algorithm. There are three types of analysis that we perform
on a particular algorithm.
3. Cont....
Ex: The running time of one operation is computed as f(n)
where n = 1,2,3,4,……linear
Another operation it is computed as g(n2).
where n =1,2,3,4 i.e g(n2 )= 1,4,9,16…… exponentially
Similarly, the running time of both operations will be nearly the
same if n is significantly.
• Best Case − Minimum time required for program execution.
• Average Case − Average time required for program execution.
• Worst Case − Maximum time required for program execution.
V.G.Jyothi Mani
3
4. Types of Data Structure Asymptotic Notation
1. Big-O Notation (Ο) – Big O notation
specifically worst case.
2. Omega Notation (Ω) – Omega(Ω)
notation specifically best case.
3. Theta Notation (θ) – This notation
represents the average complexity of
an algorithm.
V.G.Jyothi Mani
4
5. Big O Notation (Ο)
The notation Ο(n) is the formal
way to express the upper bound
of an algorithm's running time.
V.G.Jyothi Mani
5
t
N
6. Omega Notation (Ω
The notation Ω(n) is the formal way
to express the lower bound of an
algorithm's running time.
V.G.Jyothi Mani
6
N
7. Theta Notation, (θ)
The notation θ(n) is the formal
way to express both the lower
bound and the upper bound of
an algorithm's running time.
V.G.Jyothi Mani
7
N
8. Common Asymptotic Notations
constant − Ο(1)
logarithmic − Ο(log n)
linear − Ο(n)
n log n − Ο(n log n)
quadratic − Ο(n
2
)
cubic − Ο(n
3
)
polynomial − n
Ο(1)
exponential − 2
Ο(n)
V.G.Jyothi Mani
8