Answered step by step
Verified Expert Solution
Question
1 Approved Answer
7. Consider the Fibonacci numbers: F(n) = F(n - 1) + F(n - 2), n > 1; F(1) = 1; F(0) = 0. a). Write
7. Consider the Fibonacci numbers: F(n) = F(n - 1) + F(n - 2), n > 1; F(1) = 1; F(0) = 0. a). Write a recursive function to compute F(n) using the above definition directly. Imple- ment your solution and print F(i*5), where 0 1 For programs in a), b), and c) of this question, you are NOT allowed to use Python. For C++ and Java, you can only use primitive types such as char, int, long and long long. You are not allowed to use large integer, such as BigInteger in Java, from the language library. You have to write your own large integer data type or object, if needed. d) Use the Unix time facility (bash time command) to track the time needed for each algo- rithm. Compare the results and state your conclusion in two or three sentences. e) Can you use your program in a) to compute F(50) if int type of 4 bytes is used? Briefly explain your answer. Explain why your program in b) computes F(500) precisely? Algorithms and answers for 6 b) to 6 e) should be in asnl solutions.pdf For this question, for C++, when compiling option 02 should be considered and a makefile should be written such that the command "make clean" will remove all the "*0" files, the command "make asnl_a" will generate an executable file "asnl_a" for 6 a) that can be run by typing "asnl_a"; the command "make asnl_b" will generate an executable file "asnl_b" for 6 b) that can be run by typing "asn1_b"; and the command "make asnl.c" will generate an executable file "asnl_c" for 6 c) that can be run by typing "asnl_c". If you are using Java, you may not need the makefile. In that case, you should have shell script files, "asnl_a", "asnl_b", and "asnl.c" such that by typing, "asnl.a", "asnl.b", and "asnl.c", your java programs will run. 7. Consider the Fibonacci numbers: F(n) = F(n - 1) + F(n - 2), n > 1; F(1) = 1; F(0) = 0. a). Write a recursive function to compute F(n) using the above definition directly. Imple- ment your solution and print F(i*5), where 0 1 For programs in a), b), and c) of this question, you are NOT allowed to use Python. For C++ and Java, you can only use primitive types such as char, int, long and long long. You are not allowed to use large integer, such as BigInteger in Java, from the language library. You have to write your own large integer data type or object, if needed. d) Use the Unix time facility (bash time command) to track the time needed for each algo- rithm. Compare the results and state your conclusion in two or three sentences. e) Can you use your program in a) to compute F(50) if int type of 4 bytes is used? Briefly explain your answer. Explain why your program in b) computes F(500) precisely? Algorithms and answers for 6 b) to 6 e) should be in asnl solutions.pdf For this question, for C++, when compiling option 02 should be considered and a makefile should be written such that the command "make clean" will remove all the "*0" files, the command "make asnl_a" will generate an executable file "asnl_a" for 6 a) that can be run by typing "asnl_a"; the command "make asnl_b" will generate an executable file "asnl_b" for 6 b) that can be run by typing "asn1_b"; and the command "make asnl.c" will generate an executable file "asnl_c" for 6 c) that can be run by typing "asnl_c". If you are using Java, you may not need the makefile. In that case, you should have shell script files, "asnl_a", "asnl_b", and "asnl.c" such that by typing, "asnl.a", "asnl.b", and "asnl.c", your java programs will run
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started