Algorithm
Analysis
Algorithm analysis provides
theoretical estimation for the
required resources of an
algorithm to solve a specific
computational problem.
2
Why Analysis of
Algorithms is
important?
3
•To predict the behavior
of an algorithm without
implementing it on a
specific computer.
4
•It is much more convenient to have
simple measures for the efficiency of an
algorithm than to implement the
algorithm and test the efficiency every
time a certain parameter in the
underlying computer system changes.
5
•It is impossible to predict
the exact behavior of an
algorithm. There are too
many influencing factors.
6
•The analysis is thus
only an
approximation; it is
not perfect.
7
•More importantly, by
analyzing different
algorithms, we can compare
them to determine the best
one for our purpose.
8
Types
of
Algorithm Analysis
9
[Link] case
[Link] case
[Link] case
10
Best case
Define the input for which
algorithm takes less time or
minimum time. In the best
case calculate the lower
bound of an algorithm
11
Worst Case
Define the input for which
algorithm takes a long time or
maximum time. In the worst
calculate the upper bound of
an algorithm
12
Average Case
In the average case take all
random inputs and calculate
the computation time for all
inputs.
13