Worst-case scenario for Quick Sort?

Updated Apr 28, 2026

Short answer

O(n^2), occurring when the pivot is consistently the smallest or largest element (e.g., already sorted array).

Deep explanation

Intermediate sorting algorithms focus on O(n log n) efficiency and specialized constraints. O(n^2), occurring when the pivot is consistently the smallest or largest element (e.g., already sorted array).

Real-world example

Standard library sort implementations (e.g., Python's Timsort).

Common mistakes

  • Forgetting that Merge Sort requires O(n) extra space.

Follow-up questions

  • Is Quick Sort stable?
  • Time complexity of Heap Sort?

More Sorting interview questions

View all →