Home »
MCQs »
Data Structure and Algorithms (DSA) MCQs
Which of the following asymptotic notations is the best among all?
18. Which of the following asymptotic notations is the best among all?
- O(n)
- O(1)
- O(n^3)
- O(2n)
Answer
The correct answer is: B) O(1)
Explanation
- O(n3) being cubic is the worst one.
- O(n) is dependent on n.
- O(1) is constant and is the best one.
- O(2n) is dependent on n but O(n) is better.