Question: help me write a recursive method that will calculate the sum of the arrays. Remember that the array can be any size, and that the
help me write a recursive method that will calculate the sum of the arrays. Remember that the array can be any size, and that the recursive method should keep going from element to element, always decreasing the start index and increasing the end index, while adding the contents of each element in the array.
- -a call from main to the recursive sum method
- -Base case = start and end are equal
- -recursive call to method passes the array, and either an incrementing start, or a decrementing end pointer to array.
- -The sum of the array is printed accurately from main
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
