- Approach and show your work in exactly the same way as demonstrated in the example below -
Use the Master Theorem to characterize and solve the following recurrence equations by stating at the end which case was used and why:
Theorem
T(n) = c if n = 1
T(n) = a T(n/b) + f(n) if n > 1
Let f(n) be as above, where f(n) ∈ Θ(nk), k >= 0
Case 1 Example:
T(n) = 2T(n/2) + 1
In this case, what is f(n)?
And what are the values for a, b, and k? (a =? b =? k =?)
f(n) = 1 (Because in terms of n, 1 = n0)
a = 2, b = 2, k = 0
Which of the cases applies?
a = 2, and bk = 20= 1
Since 2 > 1, a > bk=> case 1
Therefore, T(n) is Θ (n log 2 2) by the master theorem.
And since log 2 2= 1, that means T(n) є Θ(n).
f(n) = n
a=25 , b=5 , k=1
25 > 51 so a > bk [case 1 applies]
T(n) = Θ(n logba) = Θ(nlog525) = Θ(n2)
============================================================================================
2. T(n) = 36T(n/6) + (n log n)2
f(n) = (n log n)2
a=36 , b=6 , k=2
36 == 62 so a == bk [case 2 applies]
T(n) =T(n) = Θ (nlogba logk+1 n ) = Θ(nlog636 log3n) = Θ(n2 log3n)
============================================================================================
f(n) = n2
a=8 , b=3 , k=2
8 < 32 so a < bk [case 3 applies]
T(n) = Θ(f(n)) = Θ(n2)
============================================================================================
- Approach and show your work in exactly the same way as demonstrated in the example...
Recurrence equations using the Master Theorem: Characterize each of the following recurrence equations using the master method (assuming that T(n) = c for n < d, for constants c > 0 and d > = 1). T(n) = c for n < d, for constants c > 0 and d greaterthanorequalto 1). a. T(n) = 2T(n/2) + log n b. T(n) = 8T(n/2) + n^2 c. T(n)=16T(n/2) + (n log n)^4 d. T(n) = 7T(n/3) + n
1. Solve the recurrence relation T(n) = 2T(n/2) + n, T(1) = 1 and prove your result is correct by induction. What is the order of growth? 2. I will give you a shortcut for solving recurrence relations like the previous problem called the Master Theorem. Suppose T(n) = aT(n/b) + f(n) where f(n) = Θ(n d ) with d≥0. Then T(n) is: • Θ(n d ) if a < bd • Θ(n d lg n) if a = b...
Discrete Math Give a big-Theta estimate for the number of additions in the following algorithm a) procedure f (n: integer) bar = 0; for i = 1 to n^3 for j = 1 to n^2 bar = bar + i + j return bar b) Consider the procedure T given below. procedure T (n: positive integer) if n = 1 return 2 for i = 1 to n^3 x = x + x + x return T(/4) + T(/4) +...
2.5. Solve the following recurrence relations and give a Θ bound for each of them. (e) T(n) 8T(n/2) n (f) T(n) = 49T(n/25) + n3/2 log n (g) T(n) = T(n-1) + 2 (h) T(n) T(n 1)ne, where c 21 is a constant (i) T(n) = T(n-1) + c", where c > 1 is some constant (j) T(n) = 2T(n-1) + 1 (k) T(n) T(vn) +1
Problem 3. (20 points) Define a relation among the functions that map from N to R+ as follows: f(n) g(n) iff f (n) is o(g(n)) i.e. f(n) is O(gfn) but g(n) is not O(f(n)). Order the following functions according to <assuming e is a real constant, 0<E<1. Provide justifcations for your answer. (a) n log n, ( e), and (h) (1/3)" ni+e, (e) (n Problem 4. (15 points) Solve the following recurrence equations and give the solution in θ notation;...
Question 2 (8 marks) (From the DPU textbook, Exercise 2.5) Using the Master theorem or recursion tree methods, solve the following recurence relations and give Θ bound for each of them a) T(n) 9T(n/3) +3n2 12n - 4, where n 21 b) T(n)-T(n-1) + n", where n > 1 and c > 0 c) T(n) = T(Vn) + 1, where n > b and T(b) = 2. Question 3: 10 marks) Suppose we have a subroutine merge2 to merge two...
Solve the following recurrences by repeatedly unrolling them, aka the method of substitution. You must show your work, otherwise you will lose points. Assume a base case of T(1) = 1. As part of your solution, you will need to establish a pat- tern for what the recurrence looks like after the k-th iteration. You must to formally prove that your patterns are correct via induction. Your solutions may include integers, n raised to a power, and/or logarithms of n....
Consider the following pseudocode: f(int n, int d) { println(space(d) + "n=" + n + " begins"); if (n > 1) { f(n/2, d+1); println(space(d+1) + "hi"); f(n/2, d+1); } println(space(d) + "n=" + n + " ends"); } where println(s) prints the string s on its own line, space(d) is a string of d spaces, and the + in the println means string concatenation. For example, if n=4 and d=2, the commands println(space(d) + "n=" + n + "...
For each of the following problems, simplify and express your answer as Θ(nk) or Θ(nk(log n wherever possible. If the asymptotic running time is exponential, then just give exponential lower bounds. Random(n) generates a random number between 1 and n with uniform distribution (every integer between 1 and n is equally likely.) CoinFlip) returns heads or tails with equal probability. Consider the following ution: Func5 (A, n) A is an array of inlegers 1 if (n <10 the retur (A])...
Please provide solution/methods so I can understand how this work. Given a algorithm with f(n) 5n2 + 4n + 14 in the worst case, f(n) 3n2 + 17 log, n + 1in the average case, and f(n) in 17 the best case. Which of the following would be the tightest possible asymptotic descriptions of the algorithm? The following statement that would be tightest possible asymptotic description of the algorithm above A) O(n) B) o (n) C) (n?) D) On Log...