1. Home
  2. Data Science
  3. Python
  4. What is the time complexity of Python's built-in sort?

Added 25 Nov 2026

What is the time complexity of Python's built-in sort?

  1. O(n)
  2. O(n^2)
  3. O(log n)
  4. O(n log n) Correct answer

Correct answer

D. O(n log n)

5 views

MCQSEXAM

Explanation

Timsort runs in O(n log n) in the worst case and O(n) on sorted data.

Reference

Asked in: Python Interview Advanced

https://docs.python.org/3/library/index.html

Preparing for an exam?

Doubts & discussion

Not sure why the answer is D? Ask here and get an explanation.

Ask a doubt about this MCQ

Shown after review. No links please.

More Python MCQs

Practise all Python MCQs

Similar MCQs