Fill This Form To Receive Instant Help

Help in Homework
trustpilot ratings
google ratings


Homework answers / question archive / The n” Fibonacci Number Write a code for ?nding the nu“ Fibonacci number

The n” Fibonacci Number Write a code for ?nding the nu“ Fibonacci number

Computer Science

The n” Fibonacci Number Write a code for ?nding the nu“ Fibonacci number. Your code should accept an integer num- ber, which indicates the n.”l Fibonacci term, and returns the sum of the Fibonacci sequence. Each number in the Fibonacci sequence is the sum of the two preceding numbers. That is, for instance, the 4”“ Fibonacci number, which is commonly written as F4, is the sum of 1 and 2. Similarly, the F5 is the sum of the two preceding numbers, 2 and 3. Provide a single program with the following: - Write a function called FibRecursive for the recursive version that takes number of level as an int. argument. Hints: 1} Identify the base case for the FibRecursive function. 2} Let the FibRecursive function call itself, with proper arguments. - Write a function called FibRecursive for the non-recursive (iterative) version that takes number of level as an int argument. - Write a main function that calls the two functions inside. You should have at least a couple of test cases included in the main flmction that show the outputs for both functions. After implementing the recursive and non-recursive functions, you are supposed to perform two additional tasks. The ?rst task is to analyze both approaches as follows: 0 Draw the recursion tree for F9 and estimate the order growth. 0 Establish the sum expression for the non-recursive approach. a Solve the sum and provide the order growth. The second task is to plot the running time of both approaches for different input sizes (in). To do that, consider ten input size (n) values: 5, ll], 20, 30, 40, 5U, 60, 80, 90, 100. For better precision, run each value ten times and take the average of all ten runs for each case.

Purchase A New Answer

Custom new solution created by our subject matter experts

GET A QUOTE

Related Questions