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

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
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
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 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 )
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)
3. Given the parametric equations x = 3t /1 + t^3 and y = 3t^2 /1...
3. Given the parametric equations x = 3t /1 + t^3 and y = 3t^2 /1 + t^3 . a) Show that the curve produced also satisfies the equation x^3 + y^3 = 3xy. b) Compute the limits of x and y as t approaches −1: i. from the left ii. from the right c) To avoid the issue in part b), graph the curve twice in the same command, once for −5 < t < −1.5 and once for...
Solve the partial differential equation by Laplace transformu_x (x,t)+u_t (x,t)=e^3t given that u(x,o)=0 , u(o,t)=e^3t
Solve the partial differential equation by Laplace transformu_x (x,t)+u_t (x,t)=e^3t given that u(x,o)=0 , u(o,t)=e^3t
Convert x=cos(3t)+sin(3t) & y=cos(t)-sin(t) into an equation of x-y form (cartesian equation). Thank you
Convert x=cos(3t)+sin(3t) & y=cos(t)-sin(t) into an equation of x-y form (cartesian equation). Thank you
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT