(Solved) : 4 10 Pts Write True False Following Statements F N N2 8 F N O N8 B F N 17 F N O N Log N Q44086624 . . .

4. (10 pts) Write true or false to each of the following statements. (a) If f(n) = n2 +8, then f(n) € O(n8). (b) If f(n) = (-17, then f(n) € O(n log n). (c) If f(n) E O(n?) and g(n) € O(n), then f(n) + g(n) € O(nº). (d) If f(n) E O(nº), then nề x f(n) E O(n^). (e) If f(n) E O(n) and g(n) E O(n?), then f(n) x g(n) € O(n^). (f) If f(n) E O(n log n), then f(n) x n E O(nlog n). (g) If f(n) E O(n?) and g(n) € O(n?), then limn f(n) € (1). (h) If f(n) E O(na) and g(n) EN(nº), then limn7 f(n) O(1). (i) If f(n) € O(na) and g(n) € O(n), then limn700 fm) O(1). (j) f(n) + g(n) E O(max f(n), g(n)). 5. (10 pts) Suppose that you have a function int Fibonacci(int n) which takes in a positive integer n and returns the nth Fibonnacci number. Assume that your function is in recursive form: it returns 1 when n = 1 or n = 2, and returns Fibonacci(n-1) + Fibonacci (n-2) when n > 2. In addition, assume that your function writes out BGN Fibonacci n at the start of the function, and writes out END Fibonacci n before the end of the function, where n is the value of the input parameter. You also have a main program which reads in a positive integer k and calls Fibonacci(k). Also assume that your main program writes out BGN main at the start of the program, and writes out END main before it stops. k=1 k=5 k=10k=20k=40 Total number of calls to Fibonacci Maximum value of BGN-END Here in the second row, you are to write out the maximum value (during the execution of the program of the number of BGN printed out minus the number of END printed out. Show transcribed image text 4. (10 pts) Write true or false to each of the following statements. (a) If f(n) = n2 +8, then f(n) € O(n8). (b) If f(n) = (-17, then f(n) € O(n log n). (c) If f(n) E O(n?) and g(n) € O(n), then f(n) + g(n) € O(nº). (d) If f(n) E O(nº), then nề x f(n) E O(n^). (e) If f(n) E O(n) and g(n) E O(n?), then f(n) x g(n) € O(n^). (f) If f(n) E O(n log n), then f(n) x n E O(nlog n). (g) If f(n) E O(n?) and g(n) € O(n?), then limn f(n) € (1). (h) If f(n) E O(na) and g(n) EN(nº), then limn7 f(n) O(1). (i) If f(n) € O(na) and g(n) € O(n), then limn700 fm) O(1). (j) f(n) + g(n) E O(max f(n), g(n)). 5. (10 pts) Suppose that you have a function int Fibonacci(int n) which takes in a positive integer n and returns the nth Fibonnacci number. Assume that your function is in recursive form: it returns 1 when n = 1 or n = 2, and returns Fibonacci(n-1) + Fibonacci (n-2) when n > 2. In addition, assume that your function writes out BGN Fibonacci n at the start of the function, and writes out END Fibonacci n before the end of the function, where n is the value of the input parameter. You also have a main program which reads in a positive integer k and calls Fibonacci(k). Also assume that your main program writes out BGN main at the start of the program, and writes out END main before it stops. k=1 k=5 k=10k=20k=40 Total number of calls to Fibonacci Maximum value of BGN-END Here in the second row, you are to write out the maximum value (during the execution of the program of the number of BGN printed out minus the number of END printed out.
Expert Answer
Answer to 4. (10 pts) Write true or false to each of the following statements. (a) If f(n) = n2 +8, then f(n) € O(n8). (b) If f(…
OR