Question: Data Structure and Algorithm Question. Please show work as to how you came to your solution. Will give thumbs up for correct answers! Thank you.
Data Structure and Algorithm Question. Please show work as to how you came to your solution. Will give thumbs up for correct answers! Thank you.
A description of a recursive algorithm is given, the task is to write down a recurrence that bounds the running time of the algorithm as tightly as possible. Then solve the recurrence. For the base case of the recurrences you may assume that the algorithm terminates in constant time for every constant size instance.
(b) On inputs of size n the algorithm makes two recursive calls on instances of size 10 and one recursive call on an instance of size n 10. After the three recursive calls are done the algorithm outputs the answer in O(1) time.
(c) The algorithm makes two recursive calls on instances of size n 3, and combines the solutions in time O(1).
(d) The algorithm spends O(n) time to divide the instance into 4 subproblems, each of size n/2. It calls itself recursively on the four subproblems. Then it combines the solutions in O(n) time.
(e) The algorithm spends O(1) time, and then makes 99 recursive calls on instances of size n/100. After the recursive calls are done it outputs a solution in O(1) time.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
