Algorithms | Recursion | Question 2
Consider the following recursive function fun(x, y). What is the value of fun(4, 3)
(x == 0)
fun(x - 1, x + y);
The function fun() calculates and returns ((1 + 2 … + x-1 + x) +y) which is x(x+1)/2 + y.
Hence Option (A) is the correct option.
Quiz of this Question
Please comment below if you find anything wrong in the above post