Professional Documents
Culture Documents
Name ID
Yetsedaw Worku Tadesse PGP/710/15
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
Time complexity of the given statement is O(n) it is linear and the dominate
factor is 3n.