
Quiz on Complexity Analysis of Algorithms
Authored by Mr. Maurya
Computers
University
Used 4+ times

AI Actions
Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...
Content View
Student View
8 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the time complexity of the following function?
int fun(int n) {
int count = 0;
for (int i = n; i > 0; i /= 2)
for (int j = 0; j < i; j++)
count += 1;
return count;
}
O(n*log(n*log(n)))
O(n^2)
O(n)
O(n*log(n))
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the time complexity of the following function?
int fun(int n) {
int count = 0;
for (int i = 0; i < n; i++)
for (int j = i; j > 0; j--)
count = count + 1;
return count;
}
Theta(n^2)
Theta(n*(log(n*log(n))))
Theta(n)
Theta(n*log(n))
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
O(n^2) is the worst-case time complexity, so among the given options it can represent:
All of the above
O(n log n)
O(1)
O(n)
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the given options provides the increasing order of asymptotic complexity of functions f1, f2, f3, and f4?
f1(n) = 2n
f2(n) = n^(3/2)
f3(n) = n*log(n)
f4(n) = n log(n)
f2, f3, f4, f1
f3, f2, f4, f1
f3, f2, f1, f4
f2, f3, f1, f4
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the time complexity of the following function?
void fun(int n, int arr[]) {
int i = 0, j = 0;
for (; i < n; ++i)
while (j < n && arr[i] < arr[j])
j++;
}
O(n^2)
O(n)
O(n*log(n^2))
O(n*log(n))
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
In a competition, four different functions are observed. If n is the size of input (positive), which function is most efficient? If n is the size of input(positive), which function is most efficient(if the task to be performed is not an issue)?
for(i = 0; i < n; i++)
for(i = 0; i < n; i += 2)
for(i = 1; i < n; i *= 2)
for(i = n; i <= n; i /= 2)
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What does it mean when we say that an algorithm X is asymptotically more efficient than Y?
X will be a better choice for all inputs except possibly large inputs
X will be a better choice for all inputs except possibly small inputs
X will be a better choice for all inputs
Y will be a better choice for small inputs
Access all questions and much more by creating a free account
Create resources
Host any resource
Get auto-graded reports

Continue with Google

Continue with Email

Continue with Classlink

Continue with Clever
or continue with

Microsoft
%20(1).png)
Apple
Others
Already have an account?
Similar Resources on Wayground
10 questions
Listen in Python
Quiz
•
University
13 questions
Chap 1: What is a program made of?
Quiz
•
University
10 questions
cp06-01-1D-Array
Quiz
•
University
10 questions
What is Artificial Intelligence?
Quiz
•
12th Grade - University
12 questions
Access
Quiz
•
University
10 questions
CHAPTER 1: COMPUTER SECURITY REVIEW
Quiz
•
University
12 questions
ASK Tingkatan 1: 2.2.2 Format Imej pada Fail yang Sama
Quiz
•
12th Grade - University
10 questions
CyberCrime
Quiz
•
5th Grade - Professio...
Popular Resources on Wayground
15 questions
Fractions on a Number Line
Quiz
•
3rd Grade
10 questions
Probability Practice
Quiz
•
4th Grade
15 questions
Probability on Number LIne
Quiz
•
4th Grade
20 questions
Equivalent Fractions
Quiz
•
3rd Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
22 questions
fractions
Quiz
•
3rd Grade
6 questions
Appropriate Chromebook Usage
Lesson
•
7th Grade
10 questions
Greek Bases tele and phon
Quiz
•
6th - 8th Grade
Discover more resources for Computers
12 questions
IREAD Week 4 - Review
Quiz
•
3rd Grade - University
20 questions
Endocrine System
Quiz
•
University
7 questions
Renewable and Nonrenewable Resources
Interactive video
•
4th Grade - University
30 questions
W25: PSYCH 250 - Exam 2 Practice
Quiz
•
University
5 questions
Inherited and Acquired Traits of Animals
Interactive video
•
4th Grade - University
20 questions
Implicit vs. Explicit
Quiz
•
6th Grade - University
7 questions
Comparing Fractions
Interactive video
•
1st Grade - University
38 questions
Unit 8 Review - Absolutism & Revolution
Quiz
•
10th Grade - University