What will be the recurrence relation of method which finds the sum of array elements?
public static int sumRecursive(int[] arr, int i) { if (i == arr.length) { return 0; } return arr[i] + sumRecursive(arr, ++i); } F(i) = arr[i] + F(i + 1) or F(arr, i) = arr[i] + F(arr, i + 1). F(n) = 0, when i becomes equal to the length of the array(n) then we return […]