Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Here is my Fibonacci.java code: public class Fibonacci { public static void main(String[] args) { int test = 45; // I will limit my test

image text in transcribed

Here is my Fibonacci.java code:

public class Fibonacci { public static void main(String[] args) { int test = 45; // I will limit my test code to passing int parameters BigInteger test2 = new BigInteger("45"); // only needed for overload System.out.println(theBigFib(test)); // a fast recursive version System.out.println(theBigFib(test2)); // overload, using same as above System.out.println(fibonacci(test)); // slow version in text } // this method will do the fibonacci calculation, but is very inefficient and slow. public static int fibonacci(int n) { if (n value) { return next; } return theBigFibHelper(next, first.add(next), count + 1, value); } }

Use the System clock (milliseconds) and demonstrate run-time complexity for Assignment #12 (Fibonacci) Are they O(N), or O(NA2), or O(2AN), or O(NAN), or O(1), or O(N!), or??? for these two algorithms, where N is the number of Fibonacci numbers generated. One is very fast (so you test with huge N values), and the one provided in the problem statement is very slow (can hardy get past N of 50) Create an Excel workbook of your results, and clearly (in titles) indicate your answers for Big-O. Your charts should have a title, label axes, a line that proposes your answer, and appropriate scales from zero to whatever is large enough to encompass your data. Everyone will have different data, but we should all come to the same Big-O conclusions, that fibonacci(test) is O??? and the BigFib(test2) is O??? You will likely start with some preliminary results, using just 8 or 10 elements as suggested in text, often getting slightly different results, something like Preliminary.JPG In the end you will clean things up and get a more polished final chart that displays on the first worksheet along with your data FinalEst.JPG Crucial consideration: Big-O is the trend (slope) from small N to large N. theBigFib will use much larger N values for testing, as compared to the slow provided fibonacci method. Submit 2 files here: 1. your Testing.java program 2. your Excel workbook (xlxs)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

SQL Database Programming

Authors: Chris Fehily

1st Edition

1937842312, 978-1937842314

More Books

Students also viewed these Databases questions

Question

How does nonverbal communication express cultural values?

Answered: 1 week ago

Question

7. Explain why retirees may be valuable as part-time employees.

Answered: 1 week ago