Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Please answer question b. Thank you. Write a C++ program, no need to be object-oriented, to test the following three functions. Each function receives one
Please answer question b. Thank you.
Write a C++ program, no need to be object-oriented, to test the following three functions. Each function receives one parameter n, which is a positive integer. int F1(int n) if (n == 0) return 1; if (n % 2 == 0) { int result = F1(n / 2); return result * result; else return 2 * F1(n - 1); int F2(int n) if (n == 0) return 1; return 2 * F2 (n - 1); int F3(int n) if (n == 0) return 1; return F3(n - 1) + F3(n - 1); Test the functions by calling them with the following values for n: 1, 3, 5, 16, 24, 26, 30. Submit your test program and in your report answer the following questions: a. What does each function return as a function of input parameter n? b. Which function is the worst in terms of time efficiency? Support your answer by stating, without proof, the running time growth rate, as a function of n, of each of the above functionsStep 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