How to make Quick Sort stable?

Updated Apr 28, 2026

Short answer

By using extra space to store the original indices or using stable partitioning schemes.

Deep explanation

Intermediate sorting algorithms focus on O(n log n) efficiency and specialized constraints. By using extra space to store the original indices or using stable partitioning schemes.

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 →