Question: Please answer the question with all work shown Problem 1 a) For each function f from the following list of functions, determine which g makes

Please answer the question with all work shown

Problem 1

a) For each function f from the following list of functions, determine which g makes f(n) is O(g(n)) true. The point of representing a function in this form is to create the simplestpossible function g(n), e.g., do not include a coecient in g(n), since it does not matter. Represent your answer as an equality (e.g., p(n) = O(n^2)).

a(n) = 8n + 3 = O(n)

b(n) = 12n + n^2 + 64

c(n) = 2log(n) + n

d(n) = log(n) + 2

e(n) = 2n

b) Using Big-O notation, determine the number of times the function count is called when the following code fragment runs, in terms of the variable n.

for (int i = 0; i < n; i++) for (int j = 0; j < n; j++) for (int k = 0; k < j; k++) count(); 

c) Using Big-O notation, determine the number of times the function count is called when the following code fragment runs, in terms of the variable n.

for (int i = n; i > 0; i/=2) for (int j = 0; j < n; j++) for (int k = 0; k < 1000; k++) count();

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!