Question

Solve the following recurrence relation, subject to the basis. S(1) = 2 S(n) =2S(n/2) + 2n

Solve the following recurrence relation, subject to the basis. S(1) = 2 S(n) =2S(n/2) + 2n

Homework Answers

Answer #1

Solutions:-

given

S(1) = 2 S(n) =2S(n/2) + 2n

now we are consider that

S(n)= 2 , n=1

S(n)=2S(n/2)+2n ,    n>1   

S(n)=2S(n/2)+2n --------------------(1)

S(n/2)=2S(n/22)+2*(n/2)

=2S(n/22)+n

put the value of S(n/2) on equation (1).

S(n)=2[2S(n/22)+n]+2n

=22S(n/22)+2n+2n

S(n) =22S(n/22)+4n-------------------(2)

S(n/22)=2S(n/23)+2*(n/22)

=2S(n/23)+(n/2)

S(n)=22[2S(n/23)+(n/2)]+4n

S(n) =23S(n/23)+6n-------------------(3)

|

|

|

|

S(n)=2kS(n/2k)+2kn (using K term)

2k is constant so we can write it as only k

S(n)=2kS(n/2k)+kn

let we are assume that

S(n/2k)=S(1)

n/2k=1

or,n=2k

or,k =log n

now,

S(n)=n*1+n(log n)

time complexity=O(n log n)

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Solve the following recurrence relation, subject to the basis. S(1) = 2 S(n) =2S(n/2) + 2n
Solve the following recurrence relation, subject to the basis. S(1) = 2 S(n) =2S(n/2) + 2n
Solve the following recurrence relation, subject to the basis. S(1) = 2 S(n) = S(n –...
Solve the following recurrence relation, subject to the basis. S(1) = 2 S(n) = S(n – 1) + 2n please explain how you solved this, thank you!
Solve the following recurrence relation, subject to the basis. S(1) = 2 S(n) = S(n –...
Solve the following recurrence relation, subject to the basis. S(1) = 2 S(n) = S(n – 1) + 2n please try to explain the process if possible, Thank you!
Solve the following recurrence relation, subject to the basis. S(1) = 4 S(n) = S(n/2) +...
Solve the following recurrence relation, subject to the basis. S(1) = 4 S(n) = S(n/2) + 2n please try to explain the process if possible, Thank you!
Solve the recurrence relation subject to the following constraints: (a) S(0) = 2. (b) S(n +...
Solve the recurrence relation subject to the following constraints: (a) S(0) = 2. (b) S(n + 1) = 2S(n) + 1
Solve the recurrence relation using the substitution method: 1. T(n) = T(n/2) + 2n, T(1) =...
Solve the recurrence relation using the substitution method: 1. T(n) = T(n/2) + 2n, T(1) = 1, n is a 2’s power 2. T(n) = 2T(n/2) + n^2, T(1) = 1, n is a 2’s power
Consider the following recursive equation s(2n) = 2s(n) + 3; where n = 1, 2, 4,...
Consider the following recursive equation s(2n) = 2s(n) + 3; where n = 1, 2, 4, 8, 16, ... s(1) = 1 a. Calculate recursively s(8) b. Find an explicit formula for s(n) c. Use the formula of part b to calculate s(1), s(2), s(4), and s(8) d Use the formula of part b to prove the recurrence equation s(2n) = 2s(n) + 3
Given the following recurrence relation, convert to T(n) and solve using the telescoping method. T(2n) =...
Given the following recurrence relation, convert to T(n) and solve using the telescoping method. T(2n) = T(n) + c1 for n > 1, c2 for n = 1
Solve the following recurrence relation T(1) = c1 T(n) = 2*T(n/2) + c2
Solve the following recurrence relation T(1) = c1 T(n) = 2*T(n/2) + c2
Solve the Recurrence Relation T(n) = 2T(n/3) + 2, T(1) = 1
Solve the Recurrence Relation T(n) = 2T(n/3) + 2, T(1) = 1