Question: Suppose that we have declared an array as follows: intlari (23,4712, 18, 56). Consider the call minar(1,0, c) to the recursive function defined below. A)
Suppose that we have declared an array as follows: intlari (23,4712, 18, 56). Consider the call minar(1,0, c) to the recursive function defined below. A) What will be in the most recent stack frame just before the function gets to the base case for the last time. B) Give a tracing tree for the call minar(ar1,0,4). Show each recursive call, its parents and children, and the value it returns. public static int minAr(int[] a, int start, int end){ if (start =- end){ return a[start]; } else { int middle - (start + end)/2; return Math.min(minArca, start, middle), minArca, middle + 1, end)); } }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
