Question

In: Computer Science

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 )

Solutions

Expert Solution

Solution:

(a)

Given,

=>x(n) = x(n-1) + 3 for n > 1 and x(1) = 0

Explanation:

Solving recurrence relation using substitution:

=>x(n) = x(n-1) + 3...(1)

=>x(n-1) = x(n-2) + 3....(2)

From (1) and (2)

=>x(n) = x(n-2) + 3 + 3

and so on.

=>x(n) = x(n-p) = 3 + 3 + ... p times

=>x(n) = x(n-p) = 3*p....(3)

We know that x(1) = 0

=>n - p = 1

=>p = n - 1...(4)

From (3) and (4)

=>x(n) = 0 + 3*(n-1)

=>Hence x(n) = 3*(n-1)

(b)

Given,

=>x(n) = 5(x - 1) for n > 1, x(1) = 6

Explanation:

Solving recurrence relation using substitution:

=>x(n) = 5(x - 1)....(1)

=>x(n-1) = 5(x-2)...(2)

From (1) and (2)

=>x(n) = 5^2x(n-2)

and so on

=>x(n) = 5^px(n-p)....(3)

We know that x(1) = 6

=>n - p = 1

=>p = n - 1

=>x(n)= 5^(n-1)*6

=>Hence x(n) = 6*5^(n-1)

(c)

Given,

=>x(n) = x(n/5) + 1 for n > 1 and x(1) = 1

Explanation:

Solving recurrence relation using substitution method:

=>x(n) = x(n/5) + 1....(1)

=>x(n/5) = x(n/5^2) + 1...(2)

From (1) and (2)

=>x(n) = x(n/5^2) + 1 + 1

and so on.

=>x(n) = x(n/5^p) + 1 + 1 + ...p times

=>x(n) = x(n/5^p) + 1*p..(3)

We know that x(1) = 1

=>n/5^p = 1

=>x = 5^p

Taking log both sides on base 5

=>p = log5(x)...(4)

From (3) and (4)

=>x(n) = 1 + 1*log5(x)

=>Hence x(n) = log5(x) + 1

I have explained each and every part with the help of statements attached to the answer above.


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
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
Solve the given non-homogeneous recurrence relations: an = an-1 + 6an-2 + f(n) a) an =...
Solve the given non-homogeneous recurrence relations: an = an-1 + 6an-2 + f(n) a) an = an-1 + 6an-2 - 2n+1 with a0 = -4, a1= 5 b) an = an-1 + 6an-2 + 5 x 3n with a0 = 2, a1 = 5 c) an = an-1 + 6an-2 - 36n with a0 = 10, a1= 40
Solve the following recurrence relations: (find an asymptotic upper bound O(?) for each one) a. T(n)...
Solve the following recurrence relations: (find an asymptotic upper bound O(?) for each one) a. T(n) = T(2n/3)+T(n/3) + n^2 b. T(n) = √nT(√n) + n c. T(n) = T(n-1)+T(n/2) + n The base case is that constant size problems can be solved in constant time (O(1)). You can use the induction, substitution or recursion tree method
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
- 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)
Use generating functions to solve the following recurrence relation: an = 2an−1 + 3n , n...
Use generating functions to solve the following recurrence relation: an = 2an−1 + 3n , n ≥ 1 a0 = 2
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
Find and solve a recurrence relation for the number of ways to stack n poker
Find and solve a recurrence relation for the number of ways to stack n poker chips using red, white and blue chips such that no two red chips are together. Use your solution to compute the number of ways to stack 15 poker chips.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT