Question: The following function finds the maximum element of an array A between indices p and r (inclusive) There are no intentional syntax errors or bugs

The following function finds the maximum element of an array A between indices p and r (inclusive) There are no intentional syntax errors or bugs in the code int Max(int AC, int p, int r) l int n, qi, q2, i, j, max1, max2; // Base Case: use MergeSort if (r - p maxi) return max2; else return max1; a. Write down a recurrence relation for the worst case running time of Max . Briefly justify your answer. Note: You may assume without proof that the worst case running time of MergeSort) is e(n logn) b. Find the best asymptotic upper bound you can on your recurrence relation for the worst case running time of Max ). For full credit, your upper bound must be tight. Show your work. The following function finds the maximum element of an array A between indices p and r (inclusive) There are no intentional syntax errors or bugs in the code int Max(int AC, int p, int r) l int n, qi, q2, i, j, max1, max2; // Base Case: use MergeSort if (r - p maxi) return max2; else return max1; a. Write down a recurrence relation for the worst case running time of Max . Briefly justify your answer. Note: You may assume without proof that the worst case running time of MergeSort) is e(n logn) b. Find the best asymptotic upper bound you can on your recurrence relation for the worst case running time of Max ). For full credit, your upper bound must be tight. Show your work
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
