6) There are other recursive functions such as the Lucas Sequence, how can you apply what you have learned to it? a) Iteratively computation b) Recursive computation

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

C++ language

Question #6 parts A and B. Please help me. 

Study the Fibonacci number sequence in the following forms: (1) iterative (sequential), (2) recursive, (3)
and closed form solution.
1) Examine the theoretical measure of time complexity of each.
a) Using theory compare the number of operations and time taken to compute Fibonacci numbers
recursively versus that needed to compute them iteratively.
b) How many prime Fibonacci numbers are there, and how many can you find?
c) Find the smallest Fibonacci number > 1,000,000
d) Find the smallest Fibonacci number > 1,000,000,000
2) Implement each Fibonacci form (1, 2, and 3 see above) in the C++ language (C++ 17).
Write four functions:
a) An iterative function that accepts a non-negative integer n and returns the nth Fibonacci number.
b) A recursive function that inputs a non-negative integer n and returns the nth Fibonacci number.
c) An improved recursive function that employs dynamic programming to improve the efficiency.
d) The closed form of the Fibonacci sequence (be sure to reference the golden ratio)
3) Using your software, compute a set of Fibonacci numbers employing the four techniques (c.f. 2, above);
for example, use n: {10, 15, 40, 41, 42, 50, 60, 100, 500, 600}.
a) Measure the time for each computation-send the results to a file.
* Recommend using the Chrono library from C++
b) Make certain you have "sufficient" data for convincing results.
4) Import your data (from 3) to excel for easy graphing
5) Compare the theoretical curves of Big-O with the empirical results.
a) Try running on machines with [significantly] different speeds.
b) Compare methods to answer the find an answer to question 1.c, above.
6) There are other recursive functions such as the Lucas Sequence, how can you apply what you have
learned to it?
a) Iteratively computation
b) Recursive computation
c) Recursive computation with dynamic programming.
Transcribed Image Text:Study the Fibonacci number sequence in the following forms: (1) iterative (sequential), (2) recursive, (3) and closed form solution. 1) Examine the theoretical measure of time complexity of each. a) Using theory compare the number of operations and time taken to compute Fibonacci numbers recursively versus that needed to compute them iteratively. b) How many prime Fibonacci numbers are there, and how many can you find? c) Find the smallest Fibonacci number > 1,000,000 d) Find the smallest Fibonacci number > 1,000,000,000 2) Implement each Fibonacci form (1, 2, and 3 see above) in the C++ language (C++ 17). Write four functions: a) An iterative function that accepts a non-negative integer n and returns the nth Fibonacci number. b) A recursive function that inputs a non-negative integer n and returns the nth Fibonacci number. c) An improved recursive function that employs dynamic programming to improve the efficiency. d) The closed form of the Fibonacci sequence (be sure to reference the golden ratio) 3) Using your software, compute a set of Fibonacci numbers employing the four techniques (c.f. 2, above); for example, use n: {10, 15, 40, 41, 42, 50, 60, 100, 500, 600}. a) Measure the time for each computation-send the results to a file. * Recommend using the Chrono library from C++ b) Make certain you have "sufficient" data for convincing results. 4) Import your data (from 3) to excel for easy graphing 5) Compare the theoretical curves of Big-O with the empirical results. a) Try running on machines with [significantly] different speeds. b) Compare methods to answer the find an answer to question 1.c, above. 6) There are other recursive functions such as the Lucas Sequence, how can you apply what you have learned to it? a) Iteratively computation b) Recursive computation c) Recursive computation with dynamic programming.
Expert Solution
steps

Step by step

Solved in 3 steps

Blurred answer
Knowledge Booster
Declaring and Defining the Function
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education