Asymptotic Notation · Algorithms
40 questions · asked in 21 of 27 years (2000–2026)
MCQ 37 · MSQ 2 · NAT 11-mark 27 · 2-mark 13
2000Questions per year2026
Questions 16–20 of 40
Consider the equality and the following choices for X
I.
II.
III.
IV.
The equality above remains correct if X is replaced by
I.
II.
III.
IV.
The equality above remains correct if X is replaced by
Answer: (C)
Any function is also and . It is not .
Answer: I or III or IV but not II
Let and where n is a positive integer. Which of the following statements is/are correct?
I.
II.
I.
II.
Answer: (D)
For integer , the values come arbitrarily close to every number in (because is irrational, the angles radians keep landing in new places around the circle). So there are infinitely many with and infinitely many with .
For the first kind, , so . Then fails for every constant , so II () is false.
For the second kind, , so . Then fails for every constant , so I () is false.
Answer: (D)
For the first kind, , so . Then fails for every constant , so II () is false.
For the second kind, , so . Then fails for every constant , so I () is false.
Answer: (D)
Consider the following function:
int unknown(int n){
int i, j, k=0;
for (i=n/2; i<=n; i++)
for (j=2; j<=n; j=j*2)
k = k + n/2;
return (k);
} The return value of the function isAnswer: (B)
Look at each part of the code:
- Outer loop: it runs n/2 + 1 times.
- Inner loop (j is doubled each time): it runs about times.
- Each pass adds n/2 to k.
So the value returned is:
Answer:
- Outer loop: it runs n/2 + 1 times.
- Inner loop (j is doubled each time): it runs about times.
- Each pass adds n/2 to k.
So the value returned is:
Answer:
Let W(n) and A(n) denote respectively, the worst case and average case running time of an algorithm executed on an input of size n. Which of the following is ALWAYS TRUE?
Answer: (C)
The average case is an average of running times over inputs of size , and each of them is at most the worst case. So for every , which means . This is always true.
The others can fail:
(A) fails for quicksort: but .
(B) fails for the same reason.
(D) fails when the two are the same order, for example merge sort, where both are .
Answer: (C)
The others can fail:
(A) fails for quicksort: but .
(B) fails for the same reason.
(D) fails when the two are the same order, for example merge sort, where both are .
Answer: (C)
Which of the given options provides the increasing order of asymptotic complexityoffunctions f1, f2, f3 and f4?
Answer: (A)
Let us check each function:
- grows more slowly than
- grows faster than any polynomial
- but , so
Answer:
- grows more slowly than
- grows faster than any polynomial
- but , so
Answer:
Keep practising