Write a recursive method that will compute cumulative sums in an array. To find the cumulative sums,

Question:

Write a recursive method that will compute cumulative sums in an array. To find the cumulative sums, add to each value in the array the sum of the values that precede it in the array. For example, if the values in the array are [2, 3, 1, 5, 6, 2, 7], the result will be [2, (2) + 3, (2 + 3) + 1, (2 + 3 + 1) + 5, (2 + 3 + 1 + 5) + 6, (2 + 3 +1 + 5 + 6) + 2, (2 + 3 + 1 + 5 + 6 + 2) + 7] or [2, 5, 6, 11, 17, 19, 26]. The parenthesized sums in the previous example are the results of a recursive call.

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Question Posted: