Re:Gaming CS Interviews
by tempodox on Wednesday September 28, 2022 @05:07AM
(#33005936)
O(1) would mean same storage requirement regardless of element count.
[ Parent
| on HN ]
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.