Consider the following recursive function:
int test(int x, int y)
{
if (abs(x - y)
return x + y;
else if (x > y)
return test(x - 1, y + 1);
else if (y > x)
return test(x + 1, y - 1);
}
What is the output of the following statements? (4, 6)
a. cout <><>
b. cout <><>
c. cout <><>
d. cout <><>
e. cout <>
Write a recursive algorithm to multiply two positive integers m and n using repeated addition. Specify the base case and the recursive case. (2, 3, 4, 6)
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here