Analysis of Algorithm I
Analysis of Algorithm I
Algorithms
z
z
z
Nonrecursive algorithms
Recursive algorithms
Algorithms visualization:
z
z
Analysis of Nonrecursive
Algorithms
General plan for analyzing efficiency of nonrecursive
algorithms:
1.
Decide an a parameter (parameters) indicating an
inputs size.
2.
Identify the algorithms basic operation.
3.
Check whether the number of times the basic
operation is executed depends only on the size of an
input.
4.
Set up a sum expressing the number of times the
algorithms basic operation is executed.
5.
Using standard formulas and rules of sum manipulation
for the count, establish its order of growth.
3
r 1
k =0
n
6
k=1
n
k =
k =1
n ( n + 1)
2
2
2
n
(
n
+
1)
3
k
=
4
k =1
n