Question

Calculate the Big-O time complexity. Show work 7. 0.1n + 100n^2 8. 100n + 0.01n^2 9....

Calculate the Big-O time complexity. Show work

7. 0.1n + 100n^2

8. 100n + 0.01n^2

9. 100n log3 n + n^3 + 100n

10. n + n/2 + n/4 + · · · + 1

Homework Answers

Answer #1

7) 0.1n is linear in n and 100 n^2 is quadratic.

So Big -O time complexity is O(n^2) as it is the highest order in the given notation.

8) 100n is linear in n and 0.01n^2 is quadratic

So Big -O time complexity is O(n^2) as it is the highest order in the given notation.

9) 100n log3n (here 100n is linear in n, log3n results in constant), n^3 is cubic and 100n is again linear in n.

The highest order in the notation 100n log3n + n^3 + 100n  is n^3. Therefore, the given notaion has a time complexity of O(n^3).

10) n + n/2 + n/4 + · · · + 1

In this noation each element (i.e., n, n/2, n4/4, ... is linear in n)

Therefore the time complexity of n + n/2 + n/4 + · · · + 1 is O(n).

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
What is the time complexity of the following code? (in big-O notaion) sum = 0 count...
What is the time complexity of the following code? (in big-O notaion) sum = 0 count = 0 var1 = 0 for: i=1 to n{ sum = sum+i for j=1 to [(3i+2i)(5n)(2i)]{ var1 = sum+count} } for m = i to j*j{ sum = sum*sum var2 = sum - (count+3)}
How to measure the time complexity of an algorithm? Identify an important operation in the algorithm...
How to measure the time complexity of an algorithm? Identify an important operation in the algorithm that is executed most frequently. Express the number of times it is executed as a function of N. Convert this expression into the Big-O notation. A. For each of the three fragments of code, what is its worst-case time complexity, in the form "O(…)". (Use the given solution to the first problem as a model)                 //----------------- This is a sample problem – solved ------...
Use Big-O Notation to characterize the computational cost of algorithm A1 and A2. The complexity of...
Use Big-O Notation to characterize the computational cost of algorithm A1 and A2. The complexity of A1 is 10000 * n, with n being the number elements processed in A1. The complexity of A2 is 100 * n, with n elements in A2. State in Big-O notation the cost of f1, with f1(x) = log2(2x) – 14x + 3 sqrt(x) + 12x^2 - 150 this is also a theoretical question just answer no code.
Given the recursive bubble sort algorithm, analyze its time complexity in terms of Big O. bubbleSort(A[],...
Given the recursive bubble sort algorithm, analyze its time complexity in terms of Big O. bubbleSort(A[], n) { // Base case if (n == 1) return;    // One pass of bubble sort. After // this pass, the largest element // is moved (or bubbled) to end. for (i=0; i<n-1; i++) if (A[i] > A[i+1]) swap(A[i], A[i+1]);    // Largest element is fixed, // recur for remaining array bubbleSort(A, n-1); }
Consider the following: period 1, 2, 3, 4, 5, 6, 7, 8 demand 7, 8, 9,...
Consider the following: period 1, 2, 3, 4, 5, 6, 7, 8 demand 7, 8, 9, 10, 14, 16, 13, 16 a. using a trend projection, forecast the demand for period 9 b. calculate the MAD for this forecast Show all work! do not use excel or phstat!!!
Find the big-O, big-Omega of the following functions (show steps please) a) f(n) = 5n^2 +...
Find the big-O, big-Omega of the following functions (show steps please) a) f(n) = 5n^2 + 1 b) f(n)= (nlogn+1)*(n+1)
Analyze the following code and provide a "Big-O" estimate of its running time in terms of...
Analyze the following code and provide a "Big-O" estimate of its running time in terms of n. Explain your analysis. for (int i = n; i >= n; i = i/2)           some O(1) time statements; end for
2. Write the big-O expression to describe the number of operations required for the following two...
2. Write the big-O expression to describe the number of operations required for the following two pieces of code. You need to explain your solution and show your work. (3 points) code 1: counter = 0       for (i = 1; i < n; ++i) {           for (j = 1; j < i; j++) { counter++; }    } code 2: counter = 0; for (i = 1; i < n; ++i) { for (j = 1; j <...
Using Big O notation, indicate the time requirement of each of the following tasks in the...
Using Big O notation, indicate the time requirement of each of the following tasks in the worst case. Computing the sum of the first n even integers by using a for loop            [ Choose ] O(1) O(2n) O(n*log n ) O(2^n) O(log n) O(n^2) O(n) O(2) O(n^3)          Displaying all n integers in an array            [ Choose ] O(1) O(2n) O(n*log n ) O(2^n) O(log n) O(n^2) O(n) O(2) O(n^3)          Displaying all n integers in a sorted linked chain            [ Choose...
MEDICATION ‘’A’’: 5 7 4 9 5 7 6 6 9 8 MEDICATION ‘’B’’: 3 2...
MEDICATION ‘’A’’: 5 7 4 9 5 7 6 6 9 8 MEDICATION ‘’B’’: 3 2 4 5 4 4 3 5 3 4 The SQRT(1/nA + 1/nB) = SQRT ( 1/10 + 1/10) = SQRT (0.2) = __________ The 95% CI is therefore (MA – MB) ± t α/2 * Sp * SQRT(1/nA + 1/nB) = ______ ± _____ = _____<M<_____.