In-place Sorting
Learn In-place Sorting (Sorting, Data Structures & Algorithms) with worked examples, diagrams and interview questions. Free on JavaSchoolLab.
What Does "In-Place" Mean? An in-place sort uses O(1) (or sometimes O(log n) for recursion stack) EXTRA space beyond the input array - it rearranges elements within the original array rather than building a new one. In-place: Bubble Sort, Selection Sort, Insertion Sort, Quick Sort (O(log n) stack), Heap Sort. Not in-place: Merge Sort (needs O(n) auxiliary array), Counting Sort, Radix Sort, Bucket Sort (all need O(n) or O(k) extra structures).