4 ms·
O(1) would mean same storage requirement regardless of element count.
by tempodox 4y ago
O(1) would mean same storage requirement regardless of element count.
- felixr 4y agoYes. 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.