Question: Consider the following algorithm, Algorithm Mystery (A: Array [1..n] of integer) 1&n are array starting and ending indexes begin if n end 0 Level
Consider the following algorithm, Algorithm Mystery (A: Array [1..n] of integer) \\1&n are array starting and ending indexes begin if n end 0 Level 1 a. (2 points) What does the recursive algorithm above compute? b. (3 points) Determine the recurrence expression T(n) for this algorithm. T(n)= c. (10 points) Use the Recursion Tree Method to determine the exact mathematical expression 7(n) for this algorithm. Assuming that the constant "c" for all constant terms. Drawing the recursion tree may help but you do not have to show the tree in your answer; instead, fill the table below. The level just above the base case level else Base case level 1 then return A[n] T(n)= k1 templ temp2 if templ > temp2 then return templ else return temp2 floor ((n-1)/2) Mystery (A[1..k]). Mystery (A[ (x+1)..n] Total # of recursive executions at this level Input size to each recursive execution Work done by each execution, excluding the recursive calls Total work done at this level
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
