Question: (20 pts)(Recursive strategy's efficiency). The maximum number represented by int data type is 2,147,483,647. The value of Fibonacci (n) grows exponentially as we mentioned in

 (20 pts)(Recursive strategy's efficiency). The maximum number represented by int data

(20 pts)(Recursive strategy's efficiency). The maximum number represented by int data type is 2,147,483,647. The value of Fibonacci (n) grows exponentially as we mentioned in the class. 1. Run your program to calculate Fibonacci(n) sequence to find the minimumn which makes that the value of Fibonacci (n) exceeds the maximum value of the signed 32-bit integer a. b. The recursive algorithm for Fibonacci (n) is so inefficient that it takes unreasonable time to run it when n is larger enough, i.e., every time n goes up by 1, the computational time almost doubles. To verify recursive strategy's inefficiency in this case, run your program and compare the runtime to calculate Fibonacci value using iterative strategy and recursive one, what is the difference of the runtime? If the value of Fibonacci (n) exceeds the maximum integer your computer can hold, you can use Biglnteger class in Java. Run the following codes to find the value of Fibonacci which just exceeds 2,147,483,647 C. package HW2; import java.math.Biglnteger; public class FibonacciBiglnt public static void main( Stringl args) int n 47 Biglnteger f1-new Biglnteger("1"); Biglnteger f2-new Biglnteger("1"); Biglnteger f-new Biglnteger("1"); for(int i 3;k n;itt) f-f2.add(f1); f2-f1; f1-f System.out.println("The "+n+th Fibonacci term is:"+f)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!