- Write a well-commented program in python with the followingfunctions:
- A main function that calls the following recursive andnon-recursive functions:
- Functions for computing Nth Fibonacci number for differentvalues of N as described
- Functions for computing factorial of a given number
- Recursive function to compute Nth Fibonacci number
- Non-recursive function to compute Nth Fibonacci number
- Recursive function to compute factorial of a given numberN
- Non-recursive function to compute factorial of a given numberN
- A main function that calls the following recursive andnon-recursive functions:
f. Your program should record timetaken only by recursive function to compute Nth Fibonaccinumber
Record the time take for different values of N such as N < 10,10 < N < 20, 20 < N < 30, and so on. Consider at least5 different values of N.
g. Your program should record timetaken only by non-recursive function to compute Nth Fibonaccinumber
Record the time take for different values of N such as N < 10,10 < N < 20, 20 < N < 30, and so on. Consider at least5 different values of N.
h. Your program should record timetaken only by recursive function to compute factorial of a givennumber N
Record thetime take for different values of N such as N < 10, 10 < N< 20, 20 < N < 30, and so on. Consider at least 5different values of N.
i. Your program should record timetaken only by non-recursive function to compute factorial of agiven number N
Record the time take for different values of N such as N < 10,10 < N < 20, 20 < N < 30, and so on. Consider at least5 different values of N.
Write a report/summary along with atable presenting the time taken each of the methods for consideredvalues of N. Comment on your findings about time taken by recursiveand non-recursive functions for both Fibonacci and Factorialfunctions. What similarities or differences do you see in recursiveand non-recursive functions for Fibonacci and Factorial functionsand why?
Your submission should include your python program and yourreport.
Fill this table of your results:
Value of N (Note: you can use other values of N) |
Time Taken Fib (Recursive Function) in ms or sec |
Time Taken Fib (Non- Recursive Function) in ms or sec |
Time Taken Fact (Recursive Function) in ms or sec |
Time Taken Fact (Non- Recursive Function) in ms or sec |
5 |
||||
15 |
||||
25 |
||||
35 |
||||
45 |
Expert Answer
Answer to Write a well-commented program in python with the following functions: A main function that calls the following recursi…