← Quiz: STL Algorithms: all 10 questions
Quiz: STL Algorithms · Question 9 of 10
What is the time complexity of sort on n elements?
What is the time complexity of sort on n elements?
- A.O(n)
- B.O(n log n)
- C.O(n²) always
- D.O(log n)
Answer & explanation
Correct answer: O(n log n)
std::sort is guaranteed O(n log n) comparisons.
Can you get the rest right without peeking?
Take the timed Quiz: STL Algorithms quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →