Space complexity: recursion stack vs buffers
Intermediate
Asymptotics & empirical timing
Created by Pavel
· 29.04.2026 at 19:08 UTC
Auxiliary space counts extra memory beyond the input itself: recursion stack frames, temporary buffers for merges, copies of columns, intermediate tensors. An algorithm can be O(n) time but O(n) extra space if it allocates a result array; or O(log n) stack depth for balanced recursive divide-and-conquer.
Iterative binary search uses O(1) extra indices; recursive binary search uses O(log n) stack frames in typical implementations. In-place algorithms try for O(1) extra space but may be harder to read.
In pandas/NumPy, “copy” vs “view” semantics interact with this: accidental df.copy() doubles resident memory for wide tables.
Space complexity (intro): [1].
Sources
University approvals: 0
Tasks
Card Info
- Topic: Asymptotics & empirical timing
- Difficulty: Intermediate
- Completed: 0 users
Creator
Pavel