Algorithms and Data Structures · Junior · Question 11 of 75
What does O(1) extra space mean for an algorithm?
- ✓Correct answer: Its extra memory stays the same for any input size
- 2It runs without allocating any memory at all
- 3It uses exactly one variable, no matter what it does
Explanation
O(1) space means a fixed amount of additional memory regardless of n: a few counters or pointers. Reversing an array in place with two indices is O(1) space; copying it into a new array is O(n).