Question: 7 . Calculate the Fibonacci Sequence for n Floating Point Values The result of the following method should calculate the first n numbers of the

7. Calculate the Fibonacci Sequence for n Floating Point Values
The result of the following method should calculate the first n numbers of the Fibonacci sequence and print that result to the console. This time you will be required to transform your integers into floating point values before calculation.
As the Fibonacci sequence is recursive, you may write a recursive algorithm but it is not strictly necessary. Using a standard recursion algorithm would result in an exponential increase in time complexity for higher values of n.
For your consideration:
In java, an integer (int) and a floating point number (float) may have the same numerical value(9 and 9.0) but as different data types in java they are calculated differently. The level of precision also has a small effect on the amount of time it takes to do a calculation. The amount of time to calculate the following numbers would increase in order: 9-9.0-9.00-9.000
Time complexity is calculated using not only the processing time for the calculation but also the time required for reading and writing memory. Because this calculation is recursive it must read and write memory of multiple variables for every calculation. If you decide to use a recursive algorithm it would be useful to consider the same time complexity effects we think about when designing sorting algorithms.

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!