Fill in the code to complete the following method for computing a Fibonacci number.

```
public static long fib(long index) {
if (index == 0) // Base case
return 0;
else if (index == 1) // Base case
return 1;
else // Reduction and recursive calls
return __________________;
}
```
a. fib(index - 1)
b. fib(index - 2)
c. fib(index - 1) + fib(index - 2)
d. fib(index - 2) + fib(index - 1)

c. fib(index - 1) + fib(index - 2)
d. fib(index - 2) + fib(index - 1)

Computer Science & Information Technology

You might also like to view...

A technician is setting up a public server for their company. The IP address of the server is 19.19.0.1. Which of the following is the default subnet mask for the server?

A. 255.255.255.255 B. 255.255.0.0 C. 255.255.255.0 D. 255.0.0.0

Computer Science & Information Technology

Which of the following methods is NOT called by the nonrecursive stack version of the isPath method?

a) insertAdjacent b) unvisitAll c) markVisited d) getNextCity

Computer Science & Information Technology