Science Computer Science
COMP 3530 Exam 1 |2025 Update Comprehensive
Frequently Tested Questions And Verified Answers
|100% Accurate Answers | Already Graded A+
An algorithm's total run time O(n + p)
is given by the expression
T(n, p) = 10n + p. What is
the Big O Notation for this?
What is this big O O(1)
notation of this code
block?
for (int i = 100; i
> -1; i--) { for (int
j = 1; j > 1; j /=2)
{
//O(1) statemets
}
}
What is the big O notation O(n)
of this code block?
for (int i = n; i >
0; i /= 2) { for
(int j = 1; j < i;
j++) { sum +=
1;
}
}
… 1/56
,6/7/25, 1:07 AM COP 3530 Exam 1 |2025 Update Comprehensive Frequently Tested Questions And Verified Answers |100% Accurate Answers | Alre…
Which one takes more time In terms of Big O, they are the same. Both O(log(n)). In
in terms of Big O? Which terms of execution, A will take more time.
will take more time in terms
of execution
time/simulation
//A
for (int i = 1; i < n; i *= 2) {
//O(1) functions
}
//B
for (int i = 1; i < n; i*= 3) {
//O(1) functions
}
Is the following statement FALSE!
accurate? "The best case
time complexity for Bubble
Sort is O(1) if the input
array only has one element"
What is the big O notation O(n)
of this code block:
// c is a positive
integer constant for (int
i = 1; i <=n, i+=c) {
//some O(1) expressions
}
for (int i = n; i > 0; i-=c) {
//some O(1) expressions
}
… 2/56
,6/7/25, 1:07 AM COP 3530 Exam 1 |2025 Update Comprehensive Frequently Tested Questions And Verified Answers |100% Accurate Answers | Alre…
What is the big O notation O(log(n))
of this code block:
// c is a positive
integer constant for (int
i = 1; i <= n; i*= c) {
// some O(1) expressions
}
for (int i = n; i > 0; i /= c) {
//some O(1) expressions
}
What is the Big O of this code: O(ab), if a is the length of arrA and b is length of arrB. 100000
units of work is still O(1)
void printUnorder(int[]
arrA, int[] arrB) { for(int i
= 0; i < arrA.length; i++) {
for(int j = 0; j <
arrB.length; j++) {
for(int k = 0; k <
10000000; k++) { cout
<< hi;
}
}
}
What is the Big O of the O(n^2)
following code:
for (int i = n; i
> 0; i--) { for
(int j = 0; j < i;
j++) {
//Some O(1) expressions
}
}
… 3/56
, 6/7/25, 1:07 AM COP 3530 Exam 1 |2025 Update Comprehensive Frequently Tested Questions And Verified Answers |100% Accurate Answers | Alre…
What is the Big O of the O(n)
following code:
for (int i = n; i >
0; i /=2) { for(int
j = 0; j < i; j++)
{
//some O(1) expressions
}
}
What is the Big O of the O(1)
following code:
for (int i = 0; i < 1000000000;
i++) {
//some O(1) functions
}
Which of the following B. log(x)
algorithms grows faster?
a. log(log(x))
b. log(x)
c. Grow at same rate
Which of the following c. Grow at same rate
algorithms grows faster?
a. log3(x) => log base 3
b. log2(x) => log base 2
c. Grow at same rate
Which of the following B (nlog(n)), D(log(n)), and E(5,000,000)
functions belongs to the
family O(n^2)?
a. n^3
b. nlog(n)
c. n!
d. log(n)
e. 5,000,000
O(n *m), where n is the number of strings and m is the
What is the time complexity of length in characters of the longest string.
an algorithm that is counting
the number of "a"s in an -Note: if the length of the string is limited to perhaps 10
… 4/56