Question: Question 1 (10 points) Saved Using the Big O notation, estimate the time complexity of the code below. Briefly explain how you derive your answer.
Question 1 (10 points)
Saved
Using the Big O notation, estimate the time complexity of the code below. Briefly explain how you derive your answer.
int count = 1; while (count < n) { count = count * 2; }
|
|
Question 2 (10 points)
Using the Big O notation, estimate the time complexity of the code below. Briefly explain how you derive your answer.
int count = 10; while (count < n) { count = count * 3; }
|
|
Question 3 (10 points)
Using the Big O notation, estimate the time complexity of the code below. Briefly explain how you derive your answer.
for (int i=0; i
|
|
Question 4
Using the Big O notation, estimate the time complexity of the code below. Briefly explain how you derive your answer.
for (int i=0; i
|
|
Question 5
Using the Big O notation, estimate the time complexity of the code below. Briefly explain how you derive your answer.
for (int i=0; i
|
|
Question 6
Using the Big O notation, estimate the time complexity of the code below. Briefly explain how you derive your answer.
for (int i=0; i
|
|
Question 7
Using the Big O notation, estimate the time complexity of the code below. Briefly explain how you derive your answer.
for (int i=0; i
|
|
Question 8
Using the Big O notation, estimate the time complexity of the code below. Briefly explain how you derive your answer.
for (int i=0; i<10; i++) { for (int j=0; j
|
|
Question 9
Using the Big O notation, estimate the time complexity of the code below. Briefly explain how you derive your answer.
public static void printArray(int[] m) { for (int i=0; i < m.length; i++) { System.out.print(m[i]); } for (int i=m.length-1; i>=0; i--) { System.out.print(m[i]); } }
|
|
Question 10
Using the Big O notation, estimate the time complexity of the code below. Briefly explain how you derive your answer.
public static void printArray2 (int[] m) { for (int i=0; i < m.length; i++) { for (int j=0; j < i; j++) { System.out.print(m[i] * m[j]); } } }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
