Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

Explain budgetary Control

Answered: 1 week ago

Question

Solve the integral:

Answered: 1 week ago

Question

What is meant by Non-programmed decision?

Answered: 1 week ago

Question

What are the different techniques used in decision making?

Answered: 1 week ago

Question

What do Dimensions represent in OLAP Cubes?

Answered: 1 week ago