The code below is for a recursive solution to computing the nth Fibonacci number.
public long fibRecursive(int n)
{
if (n <= 1)
{
return n;
}
else
{
return fibRecursive(n - 1) + fibRecursive(n - 2);
}
}
Why is the running time for the above algorithm extremely inefficient?
a) The recursive call, fibRecursive(n - 1) causes the algorithm to perform redundant calculations.
b) The recursive call, fibRecursive(n - 2) causes the algorithm to perform redundant calculations.
c) Both recursive calls cause the algorithm to perform redundant calculations.
d) The algorithm is recursive, and is thus inherently inefficient.
e) The recursive calls are performed in the wrong sequence; i.e., fibRecursive(n - 2) should be called before fibRecursive(n - 1).