You are on page 1of 3

Course Title: Advanced Design and Analysis of Algorithms

Assignment #2 :- Simplify recurrence relation by substitution

Name ID
Yetsedaw Worku Tadesse PGP/710/15

Submitted :-Dr. Million M

Date:23/05/2015
Simplify the following recurrence relation by substitution
2 n=1
T(n) = T(n-1)+3 n>1

Given T(n)=T(n-1)+3
T(n)=T(n-1)+3,….. iteration 1
Substitute T(n-1)
T(n-1)=[T(n-1-1)+3]+3
T(n-1)=T(n-2)+6 , … iteration 2
T(n)=[T(n-1-2)+3]+6
T(n)=T(n-3)+9 … iteration 1
-
-
-
-Continue for i times , i is nothing but number of recurrence and stop at some
point when n=1
Let us do pattern for the above observation
From equetion1 to 4 , you observe that n-1 ,n-2,n-3,n-4 which is n is reduced
by i and plus 3.i

Which can be written as


T(n)=T(n-i)+3.i
Assume n-i=1
n-i=1,then i=n-1
T(n)=T(n-(n-1))+3(n-1)
T(n)=T(0+1)+3n-3
T(n)=T(1)+3n-3,T(1)=2 is already given
T(n)=2+3n-3
=3n+2-3,then
T(n)=3n-1.

Time complexity of the given statement is O(n) it is linear and the dominate
factor is 3n.

You might also like