Different Functions, Same Output
Computer Science
Level
2
The two functions shown below compute the \(n^\text{th}\) Fibonacci number.
For large values of \(n\), one of the functions is significantly faster than the other. Which function is faster, fib1
or fib2
?
1 2 3 4 5 6 7 8 9 

1 2 3 4 5 6 7 8 9 10 11 12 13 14 
