3 ms·
Yes. Simplest in-place example would be bubble sort. You might need a temp element for swaps, but that's it. Heap sort can also be done with constant space. You
by felixr 4y ago
Yes. Simplest in-place example would be bubble sort. You might need a temp element for swaps, but that's it. Heap sort can also be done with constant space.
You need of course O(n) space to store the original data; but that is not part of the sort algorithm.