Weird recursion tree analysis. Suppose we have an algorithm that on problems of size n, recursively solves two problems of size n/2, with a “local running time” bounded by t(n) for some function t(n). That is, the algorithm’s total running time T(n) satisfies the recurrence relation T(n) ≤ 2T(n/2) + t(n). For simplicity, assume that n is a power of 2.
Prove the following using a recursion tree analysis
(a) If t(n) = O(n log n), then T(n) = O(n(log n)2).
(b) If t(n) = O(n/log n), then T(n) = O(n log log n).
(c) If t(n) = O(n/(log n)2), then T(n) = O(n).
Note that the Master Theorem itself cannot be used here, because the functions t(n) above are not of the form required by the Master Theorem.
Hint: for each level j, estimate the number of subproblems at that level, and the local running time for each subproblem at that level.
Weird recursion tree analysis. Suppose we have an algorithm that on problems of size n, recursively...
Suppose the following is a divide-and-conquer algorithm for some problem. "Make the input of size n into 3 subproblems of sizes n/2 , n/4 , n/8 , respectively with O(n) time; Recursively call on these subproblems; and then combine the results in O(n) time. The recursive call returns when the problems become of size 1 and the time in this case is constant." (a) Let T(n) denote the worst-case running time of this approach on the problem of size n....
(a) Your company participates in a competition and the fastest algorithm wins. You know of two different algorithms that can solve the problem in the competition. • Algorithm I solves problems by dividing them into five subproblems of half the size, recursively solving each subproblem, and then combining the solutions in linear time. • Algorithm 2 solves problems of size n by dividing them into 16 subproblems of size n/4, recursively solving each subproblem, and then combining the solutions in...
(basic) Solve T(n) = 4T(n/2) + Θ(n^2) using the recursion tree method. Cleary state the tree depth, each subproblem size at depth d, the number of subproblems/nodes at depth d, workload per subproblem/node at depth d, (total) workload at depth d. Please state everything that is asked for or your answer will be downvoted. (basic) Solve T(n)-4T(n/2) + Θ(n2) using the recursion tree method. Cleary state the d, workload per subproblem/node at depth d, (total) workload at depth d.
Analysis Divide & Conquer: Analyze the complexity of algorithm A1 where the problem of size n is solved by dividing into 4 subprograms of size n - 4 to be recursively solved and then combining the solutions of the subprograms takes O(n2) time. Determine the recurrence and whether it is “Subtract and Conquer” or “Divide and Conquer“ type of problem. Solve the problem to the big O notation. Use the master theorem to solve, state which theorem you are using...
draw the first 3 levels of a recursion tree for the recurrence T(n) = 4T(n/2) + n. How many levels does it have? Find a summation for the running time and solve for it.
Subject: Algorithm solve only part 4 and 5 please. need urgent. 1 Part I Mathematical Tools and Definitions- 20 points, 4 points each 1. Compare f(n) 4n log n + n and g(n)-n-n. Is f E Ω(g),fe 0(g), or f E (9)? Prove your answer. 2. Draw the first 3 levels of a recursion tree for the recurrence T(n) 4T(+ n. How many levels does it have? Find a summation for the running time. (Extra Credit: Solve it) 3. Use...
algorithms Assume you have the choice of two algorithms for the same problem, (a) One that reduces a problem of size n in O(n) time to two sub-problems of size in, or (b ) One that solves the problem without any recursion in time O(n2) Which algorithm is faster? Show that if f(n) f(½n) + O(log(n)), then f(n) = O((log n) 4. Write code for a function that takes a nonempty search tree of the form discussed in the class,...
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...
Suppose that, in a divide-and-conquer algorithm, we always divide an instance of size n of a problem into 5 sub-instances of size n/3, and the dividing and combining steps take a time in Θ(n n). Write a recurrence equation for the running time T (n) , and solve the equation for T (n) 2. Suppose that, in a divide-and-conquer algorithm, we always divide an instance of size n of a problem into 5 sub-instances of size n/3, and the dividing...
1.Fix any tree T on 10 vertices. Draw the recursion tree of the algorithm Find-size-node when run on the input T with a being the root of T. Can you use this to give a bound on the running time of T? 2. Consider the following problem. Check-BST • Input: A binary tree T • Output: 1 if T is a binary search tree, and 0 otherwise. Give an efficient algorithm for this problem. 3.Give a recursive algorithm for the...