Question: chegg Consider the Lucas numbers: Ln = Ln 1 + Ln 2 , n > 1 ; L 1 = 1 ; L 0 =
chegg Consider the Lucas numbers: Ln Ln Ln n ; L; L a Write a recursive function to compute Ln using the above definition directly. Implement your solution and print Li where i as output. b Write a recursive functionprocedure to compute Ln with time complexity Onmore precisely, the time complexity should be OnAn when n is large, where An is the complexity of adding Ln and Ln Implement your solution and print Li where i as output. This program must be able to compute Ln precisely for n Hint : Let Kn Ln Ln : Kn times Kn n ; K With this formulation, design a recursive algorithm for Kn such that the algorithm will return both Ln and Ln with input parameter n Hint : Can you use a primitive type to store L For programs in a and b 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 class or data type, if needed. c Use the Unix time facility bash time command to track the time needed for each algorithm. Compare the results and state your conclusion in two or three sentences. d Can you use your program in a to compute L if int type of bytes is used? Briefly explain your answer. Explain why your program in b can computes L precisely? Algorithms and answers for b to d should be in asn solutions.pdf For this question, for C when compiling option O could be considered and a makefile should be written such that the command make clean will remove all the o files, the command make asn a will generate an executable file asn a for a that can be run by typing asn a; and the command make asn b will generate an executable file asn b for b that can be run by typing asn b If you are using Java, you may not need the makefile. In that case, you should have shell script files, asn a and asn b such that by typing, asn a and asn b your java programs will run. You should use unix command script to capture the screen of the execution of your program.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
