0% found this document useful (0 votes)
31 views

Analysis of Algorithm I

This document discusses different methods for analyzing the efficiency of algorithms, including nonrecursive and recursive algorithms. It outlines general plans for analyzing both types, such as identifying basic operations, setting up sums or recurrence relations counting operations, and solving them to determine asymptotic runtime complexity. Specific techniques are presented for solving recurrence relations that arise in analyzing recursive algorithms.

Uploaded by

DoRi SatRia
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
31 views

Analysis of Algorithm I

This document discusses different methods for analyzing the efficiency of algorithms, including nonrecursive and recursive algorithms. It outlines general plans for analyzing both types, such as identifying basic operations, setting up sums or recurrence relations counting operations, and solving them to determine asymptotic runtime complexity. Specific techniques are presented for solving recurrence relations that arise in analyzing recursive algorithms.

Uploaded by

DoRi SatRia
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

Analysis of Algorithms

Solution of Analysis of Algorithms

Algorithms
z
z
z

Nonrecursive algorithms
Recursive algorithms
Algorithms visualization:
z
z

Static algorithm visualization


Dynamic algorithm visualization/animation

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

Some Useful Summation Formulae


ar n+1 a
,r 1
ar =

r 1
k =0
n

n(n +1)(2n +1)


k =

6
k=1
n

k =
k =1

n ( n + 1)
2

2
2
n
(
n
+
1)
3
k
=

4
k =1
n

Analysis of Recursive Algorithms


General plan for analyzing efficiency of recursive
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 can vary on different input of the
same size.
4.
Set up a recurrence relation, with an appropriate initial
condition, for the number of time the basic operation is
executed.
5.
Solve the recurrence, establish its order of growth.
5

Methods for Solving Recurrence


Relations
z
z
z

Method of forward substitutions.


Method of backward substitutions.
Linear second-order recurrences with
constant coefficients, using characteristic
equation.
Smoothness Rule and the Master Theorem.

You might also like