Question

In: Computer Science

Derive a Θ-bound on the solution to the following recurrence. using iterative recursion and check your...

Derive a Θ-bound on the solution to the following recurrence. using iterative recursion and check your answer with master theorem result

T(n) = T (1/3 n) + log n

Solutions

Expert Solution

Hi,

------------------------------------------------------------------

T(n) = T (1/3 n) + log n

T(n) = T (n/31) + log n

=T(n/32) + log(n/31)+log(n/30)

=T(n/33) + log(n/32) + log(n/31)+log(n/30)

  =T(n/34) + log(n/32) + log(n/31)+log(n/30)

+................+

if n= 3k then n/3k =1 and k= log3n and  T(1)=1

=T(n/3k) +log(n/3k-1) +  log(n/3k-2) + ..............+ log(n/32) + log(n/31)+log(n/30)

=T(1) + log(n/3k-1) +  log(n/3k-2) + ..............+ log(n/32) + log(n/31)+log(n/30)

=1+ log(n/3k-1) +  log(n/3k-2)   + ..............+ log(n/32) + log(n/31)+log(n/30)

=1+ log(3k/3k-1) +  log(3k/3k-2)   + ..............+ log(3k/32) + log(3k/31)+log(3k/30)    n= 3k

=1+ log3 + log32 + .....+ log3k-2 + log3k-1 + log3k

=1+ log33 + 2log33 + .....+ (k-2)log33 + (k-1)log33 + (k)log33  

=1+1+2+....+(k-2)+(k-1)+k

=1+ k(k+1)/2

=1+ k2/2 + k/2

=1+( log2n)/2 +( log​​​​​​​n)/2

now we ignore the constant terms and smaller terms.

T(n) = Θ(log2n) <---Answer

----------------------------------------------------------------------------------------------

Using Master Theorem

if T(n) =aT(n/b)+f(n) then T(n) = Θ(nlogba)

-----------------------------------------------------------

given T(n) = T (n/3) + log n

so a = 1 and b = 3 and f(n) =Θ log(n) where k =1

---------------------------------------------------

then T(n) = Θ(nlogba) = Θ(nlog31) = Θ(1)

here T(n) is logarithm time smaller than f(n)

----------------------------------------------------------

using master theorem special case :

if nlogba is logarithm time smaller than f(n) then T(n) = Θ(nlogba(log)k+1)

------------------------------------------------------------------------

so T(n) = Θ(nlog31(log)1+1) log31 = 0

T(n) = Θ(n0(log)1+1) ∵ n0 = 1

T(n) = Θ(log​​​​​​​2n) <---Answer

Conclusion: Iterative and master theorem both produce same result.

----------------------------------------------------------------------------------

Still if you have any doubt or need any kind of improvement, please let me know in comment section and if you like, Please upvote.

Thank You !


Related Solutions

Use a recursion tree to determine a good asymptotic upper bound on the recurrence ?(?) =...
Use a recursion tree to determine a good asymptotic upper bound on the recurrence ?(?) = 3?(?/3) + ?. Use the substitution method to verify your answer.
1 (10 pts) Give a big-θ bound for the solutions of the following recurrence relations. Show...
1 (10 pts) Give a big-θ bound for the solutions of the following recurrence relations. Show work. (a) T(n) = 8T(n/2) + n^3 + 100n (b) T(n) = 5T(n/4) + 3n (c) T(n) = 7T(n/3) + 100n^2 (d) T(n) = 3T(n/3) + 1000√ n (e) T(n) = T(n − 1) + n^2
Use a recursion tree to determine a good asymptotic upper bound on the recurrence T(n) =...
Use a recursion tree to determine a good asymptotic upper bound on the recurrence T(n) = 2T(n/3) + 2n. Use the substitution method to verify your answer
Use a recursion tree to determine a good asymptotic upper bound on the following recurrences. Use...
Use a recursion tree to determine a good asymptotic upper bound on the following recurrences. Use the substitution method to verify your answer. T(n) = 3T(n/2) + n. T(n) = T(n/2) + n2.
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
Please find a solution to the following: Δu=0, 1<r<4, 0≤θ<2π u(1,θ)=cos5*θ, 0<θ<2π u(4,θ)=sin4*θ, 0<θ<2π
Please find a solution to the following: Δu=0, 1<r<4, 0≤θ<2π u(1,θ)=cos5*θ, 0<θ<2π u(4,θ)=sin4*θ, 0<θ<2π
Find the closed formula solution to each of the following recurrence relations with the given initial...
Find the closed formula solution to each of the following recurrence relations with the given initial conditions. Use an iterative approach and show your work! What is a_100? a) a_n=a_(n-1)+2,a_0=3 b) a_n=a_(n-1)+2n+3,a_0=4 c) a_n=2a_(n-1)-1,a_0=1 d) a_n=-a_(n-1),a_0=5
Find the closed formula solution to each of the following recurrence relations with the given initial...
Find the closed formula solution to each of the following recurrence relations with the given initial conditions. Use an iterative approach and show your work! What is a100 ? an=an-1+2, a0=3 an=an-1+2n+3, a0=4 an=2an-1-1, a0=1 an=-an-1, a0=5
Using Θ-notation, provide asymptotically tight bounds in terms of n for the solution to each of...
Using Θ-notation, provide asymptotically tight bounds in terms of n for the solution to each of the following recurrences. Assume each recurrence has a non-trivial base case of T(1) = Θ(1). For example, if asked to solve T(n) = 2T(n/2) + n, then your answer should be Θ(n log n). Give a brief explanation for each solution. (a) T(n) = 5T(n/2) + n (b) T(n) = 4T(n/2) + n2 (c) T(n) = T(n/4) + T(n/2) + n
1- Write a program that will display the following series of integers using iterative statement of...
1- Write a program that will display the following series of integers using iterative statement of your choice, and terminate the iteration once it is larger than 200. 1, 3, 7, 13, 21, 31, 43, … use only C++!!
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT