Question: Answer the questions about the algorithm. Find-max-2(A:array [i...j] of number) 1 if i==j then return A[i] 2 m= |(i+j)/2] 3 left-max= find-max-2(A [i...m]) 4 right-max=

 Answer the questions about the algorithm. Find-max-2(A:array [i...j] of number) 1

Answer the questions about the algorithm.

Find-max-2(A:array [i...j] of number) 1 if i==j then return A[i] 2 m= |(i+j)/2] 3 left-max= find-max-2(A [i...m]) 4 right-max= find-max-2(A [m+1...j]) 5 if left-max>right-max 6 then return left-max 7 else return right-max How does this algorithm find the max? What are the legal inputs? What is the base case? Draw the recursion tree showing inputs and outputs if the input is the array [1,2,3,4,5) Is this an example of tail recursion

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!