Question

In: Computer Science

(1) T(n)=9⋅T(n3)+n2⋅(log⁡(n))2 (2) T(n) = 10 * T(n/3) + n^2 One of these can be solved...

(1) T(n)=9⋅T(n3)+n2⋅(log⁡(n))2

(2) T(n) = 10 * T(n/3) + n^2

One of these can be solved using the Master Theorem; the other cannot.

  1. Which one can be solved using the Master Theorem? Compute the solution to this recurrence relation.
  2. Which one cannot be solved using the Master Theorem? Carefully explain why not.
    (NOTE: A complete solution will use the definition of big-O.)
  3. Use another method to solve this recurrence relation. To make this a bit easier, you may assume that n = 3k for some integer k (so that k = log3(n)).
    {NOTE: If you use a recursion tree, you clearly cannot sketch it here. You can (and should) indicate the number of nodes -- for recursive calls -- at each level, the time complexity of each node, and the total time complexity for each level.)

Solutions

Expert Solution

Ans: First one can't be solved using master thorem

Because for master thorem it should be of form:

T(n) = aT(n/b) + f(n)

1) T(n) = 9.T(n^3) + f(n)

Here inside T(n^3) this term is not allowed according to master thorem form n should linear

2) T(n) = 10* T(n/3) + n^2

This can be solved because this is of master thorem form:

Sol: calculate n to the power log a base b;

Power(n , log 10 base 3) =n^ 2.095

F(n) = n^2;

So power(n, log 10 base 3) > F(n)

Complexity is theta(n^2.093)

n= 3^ k for solving second one

After substituting it :

T(3^k) = T(3^k-1) + (3^k)^2

T(3^k) = S(m)

S(m) = S(m-1) + m^2

Sol: using substitution: s(m) = S(m-2) + (m-1)^2 + m^2

S(m) = s(m-3) +( m-2)^2 +(m-1)^2+ m^2

...

..

Upto m times

S(m) = S(0) + 1^2 + 2^2 + 3^2 .... + m^2

Sum of n squared terms: n(n+1)(2n+1)/6

S(m) = S(0) + m(m+1)(2m+1)/6

S(m) = O(m^3)

K= log n base 3

M= 3^k = n

T(n) = O(n^3)

I hope this solution helps you give an upvote!!


Related Solutions

Select 3 different sized (order lg lg n, lg n, n, n lg n, n2, n3,...
Select 3 different sized (order lg lg n, lg n, n, n lg n, n2, n3, nk, cn, n!) algorithms to code using a compiler of choice (VB, C++, Java). An example would be an algorithm to search for a number in a list of n numbers à q(n), and a second algorithm to sort a list of numbers using a bubble sort à q(n2). You could also choose to just calculate a open form expression like 1 + 2...
Let N1 , N2 , N3 follow a trinomial distribution with parameters n, assume that n...
Let N1 , N2 , N3 follow a trinomial distribution with parameters n, assume that n follows a Poisson distribution with parameter λ > 0. Also assume that, conditionally on N, the random variables N1, N2, N3 follow a trinomial distribution with N trials and category probabilities p1, p2, p3 with p1 + p2 + p3 = 1. Compute the covariance and correlation of (N1,N2)
Show that (1 + 2 +. . .+n)2 > 12 +. . .+ n2, for n...
Show that (1 + 2 +. . .+n)2 > 12 +. . .+ n2, for n ≥ 2.
Programming language in Python Suppose, for Jane, n1 = 3, n2 = 4, and n3 =...
Programming language in Python Suppose, for Jane, n1 = 3, n2 = 4, and n3 = 5. Also suppose, Jane iterates the number from 1 to 15. At the beginning, Jane sets count to 0, and then proceeds iterating the number from 1 to 15 and for each iteration does the following: for 1, count is increased by 1 because it is not divisible by 3, 4, and 5; count is now: 1 for 2, count is increased by 2...
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)
1- Show that (n^3+3n^2+3n+1) / (n+1) is O (n2 ). Use the definition and proof of...
1- Show that (n^3+3n^2+3n+1) / (n+1) is O (n2 ). Use the definition and proof of big-O notation. 2- Prove using the definition of Omega notation that either 8 n is Ω (5 n ) or not. please help be with both
Ex 4. (a) Prove by induction that ∀n∈N,13+ 23+ 33+···+n3=[(n(n+ 1))/2]2 b) Prove by induction that...
Ex 4. (a) Prove by induction that ∀n∈N,13+ 23+ 33+···+n3=[(n(n+ 1))/2]2 b) Prove by induction that 2n>2n for every natural number n≥3.
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
Find T(t), N(t), and B(t) for r(t) = t^2 i + (2/3)t^3 j + t k...
Find T(t), N(t), and B(t) for r(t) = t^2 i + (2/3)t^3 j + t k at the point P ( 1, (2/3) , 1)
1. m •   (n • p) 2. (q   ⊃ ~t) • (~m v q) 3.   ~t...
1. m •   (n • p) 2. (q   ⊃ ~t) • (~m v q) 3.   ~t ⊃ z     : .     z
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT