Question: Problem #3: (40 points) The Fibonacci sequence fibi21 is defined recursively as follows: fib(1) 1, fib(2)-1 and, fib(n)fib(n-1) + fib(n-2) for n 2 3 The

Problem #3: (40 points) The Fibonacci sequence fibi21 is defined recursively as follows: fib(1) 1, fib(2)-1 and, fib(n)fib(n-1) + fib(n-2) for n 2 3 The numbers in the Fibonacci sequence are called the Fibonacci numbers, for example: 11, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233... (a) Implement a sub-linear time complexity function in Java. int fib(int n) that returns the nth Fibonacci number. Example: fib(9) returns 34. (b) What is the running time complexity of your function? Justify your answer by using the basic algorithms techniques of algorithm analysis.. Important Notes: Your Java program should print correctly the fib(250); In the resolution of this problem it is not allowed (and is not a good idea) to use .You must add the main method in your program in order to test your . There are no data errors that need to be checked as all the data will be assumed fib(250)7896325826131730509282738943634332893686268675876375 the Binet's formula. implementation. correct Your program MUST be submitted only in source code form (.java file A program that does not compile or does not run loses all correctness points
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
