Programming via Recursion
Write a recursive function to find the sum of the first num integers stored in array v.
sum (v[ ]: integer array, num: integer): integer {
if num = 0 then
return 0
else
return v[num-1] + sum(v,num-1);
}
base case
recursive
case
Previous slide
Next slide
Back to first slide
View graphic version