In-Place Sort

Domain: Algorithms

🎯 Motivation

An in-place algorithm uses only O(1) extra memory, sorting by rearranging elements within the original array.

📋 Concrete Example

Quick sort and heap sort are in-place — they swap elements within the array. Merge sort is not in-place — it needs O(n) extra arrays for merging.

🔗 Analogy

Rearranging books on a shelf without taking them off the shelf. You swap their positions in place. Merge sort would require a second shelf (extra memory).