Question

In: Computer Science

Solve the recurrence equation. T(n) = 3T (n/3) + Cn T(1) = C

Solve the recurrence equation.
T(n) = 3T (n/3) + Cn
T(1) = C

Solutions

Expert Solution

The above equation is of the form

T(n) = a* T(n/b) + f(n)

Here a = 3, b = 3 and f(n) = C*n

This recurrence relation can be solved by Master's theorem.

It has three cases. The following are the three cases :

case 1:

If f(n) = Θ(n^k) where k <   then T(n) = Θ(n  ^ ())

case 2:

If f(n) = Θ(n^k) where k =   then T(n) = Θ((n^k)*)

case 3;

If f(n) = Θ(n^k) where k > then T(n) = Θ( f(n) )

In our case a = 3 , b = 3 , k = 1

case 2 applies in our case where k =1 and also equals 1.

T(n) = Θ((n)*))

Another solution:

T(n) = 3 T(n/3) + C*n

T(n/3) = 3 T(n/9) + C*n/3

substituting T(n/3) in the first equation

T(n) = 3( 3 T(n/9) + C *n/3 ) + C* n

= 9 T(n/9) + 2* C*n ( equation 2)

T(n/9) = 3 T(n/27) + c*n/9

substituting T(n/9) in equation (2)

T(n) = 9 ( 3 T(n/27) + C*n/9) + 2 *C*n

= 27 T(n/27) + C*n + 2 * C* n

= 27 T(n) + 3 * C * n  

T(n) = (3 ^ k) * T( n / ( 3 ^k ) ) + k * C * n

Replace k with

T(1) = C

T(n) = 3^( ) *T( n / ( 3 ^ ) ) + k * C * n

3^( ) will equal to n.

n / ( 3 ^ ) will equal to 1.

T(n) = n * T(1 )  +  * C* n

T(n) = n*C +   * C* n

T(n) = O( n * )

Hence O( n *   )


Related Solutions

6. Solve the following recurrence relations t(n) = t(n-1) + 3 for n>1 t(1) = 0...
6. Solve the following recurrence relations t(n) = t(n-1) + 3 for n>1 t(1) = 0 t(n) = t(n-1) + n   for n>1 t(1) = 1 t(n) = 3t(n/2) + n    for n>1, n is a power of 2 t(1) = ½ t(n) = 6t(n-1) – 9t(n-2)   for n>1 t(0) = 0 t(1) = 1
Give upper and lower bounds for T(n) in the following recurrence: T(n) = 3T(n/4) + n
Give upper and lower bounds for T(n) in the following recurrence: T(n) = 3T(n/4) + n
- Solve the following recurrence relation : T(n) = T(αn) + T((1 − α)n) + n
- Solve the following recurrence relation : T(n) = T(αn) + T((1 − α)n) + n
Using the backward substitution method, solve the following recurrence relations: a.T(n)= T(n−1)+3forn>1 ,T(1)=0 b.T(n)=3T(n−1) forn>1 ,T(1)=7...
Using the backward substitution method, solve the following recurrence relations: a.T(n)= T(n−1)+3forn>1 ,T(1)=0 b.T(n)=3T(n−1) forn>1 ,T(1)=7 c.T(n)= T(n−1)+n for n>0 ,T(0)=0 d.T(n)= T(n/2)+n for n>1 ,T(1)=1(solve for n=2k) e.T(n)= T(n/3)+1forn>1 ,T(1)=1(solve for n=3k)
Solve the recurrence equations by Substitution a) T(n) = 4T (n/2) + n, T (1) =...
Solve the recurrence equations by Substitution a) T(n) = 4T (n/2) + n, T (1) = 1 b) T(n) = 4T (n/2) + n2 , T (1) = 1 c) T(n) = 4T (n/2) + n3 , T (1) = 1
Solve the following recurrence relations. a. x(n) = x(n − 1) + 3 for n >...
Solve the following recurrence relations. a. x(n) = x(n − 1) + 3 for n > 1, x(1) = 0 b. x(n) = 5x(n − 1) for n > 1, x(1) = 6 c. x(n) = x(n/5) + 1 for n > 1, x(1) = 1 (solve for n = 5k )
Use recursion tree to solve the recurrence: T(n) = T(n/15) + T(n/10) + 2T(n/6) + n^(1/2)
Use recursion tree to solve the recurrence: T(n) = T(n/15) + T(n/10) + 2T(n/6) + n^(1/2)
What is the recurrence relation for T(n) = (n-1)T(n-1) + n?
What is the recurrence relation for T(n) = (n-1)T(n-1) + n?
1. Using domain and range transformations, solve the following recurrence relations: a) T(1) = 1, T(n)...
1. Using domain and range transformations, solve the following recurrence relations: a) T(1) = 1, T(n) = 2T(n/2) + 6n - 1 b) T(1) = 1, T(n) = 3T(n/2) + n^2 - n
Show for the following recurrence that T(n) = T(n/3) + n*log(n) is O(n*log(n)) (not using the...
Show for the following recurrence that T(n) = T(n/3) + n*log(n) is O(n*log(n)) (not using the Master theorem please)
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT