Cs questions | Computer Science homework help

1. Write a recursive algorithm to compute a+b, where a and b are nonnegative integers.
2. Let a be an array of integers. Write a recursive algorithm to compute the average of the elements of the array.
Solutions in which the sum is recursive (instead of the average) are worth fewer points. Note stopping case.
3. Ackerman’s function is defined recursively on the nonnegative integers as follows:
a(m, n) = n + 1 if m == 0
a(m, n) = a(m-1, 1) if m != 0, n == 0
a(m, n) = a(m-1, a(m, n-1)) if m != 0, n != 0
Using the above definition, show that a(2,2) equals 7.
4. If an array contains n elements, what is the maximum number of recursive calls made by the binary search algorithm?
5. The expression m % n yields the remainder of m upon division by n. Define the greatest common divisor (GCD) of two integers x and y by:
gcd(x,y) = y if ( y