Question 51
What is the return value of find_max(a, 5) for array {3, 9, 2, 8, 5}?
int find_max(int a[], int n) {
if (n == 1) return a[0];
int m = find_max(a, n - 1);
return (a[n-1] > m) ? a[n-1] : m;
}Detailed Solution
Recursively finds the maximum element in the array, which is 9.