1. Home
  2. Computer Science MCQs
  3. Algorithms and Data Structures
  4. What is the worst-case time complexity of quicksort?

Added 2 Nov 2026

What is the worst-case time complexity of quicksort?

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

Correct answer

B. O(n²)

18 views

MCQSEXAM

Explanation

When the pivot is always the smallest or largest element, as with an already sorted array and a naive pivot, partitions are unbalanced and quicksort runs in O(n²). Its average case is O(n log n).

Reference

Asked in: GATE CS, NTS, Technical Interviews

Preparing for an exam?

Doubts & discussion

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

Ask a doubt about this MCQ

Shown after review. No links please.

More Algorithms and Data Structures MCQs

Practise all Algorithms and Data Structures MCQs

Similar MCQs