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](https://dsd5zvtm8ll6.cloudfront.net/si.experts.images/questions/2024/09/66f079f1f29b2_88966f079f18a815.jpg)
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
Get step-by-step solutions from verified subject matter experts
