juniorRecursion
What is a Stack Overflow error?
Updated Apr 28, 2026
Short answer
An error that occurs when the recursion is too deep and exhausts the call stack memory.
Deep explanation
Recursion allows for elegant solutions to hierarchical problems. An error that occurs when the recursion is too deep and exhausts the call stack memory. However, it requires careful handling of the stack to prevent memory exhaustion.
Real-world example
Traversing a family tree.
Common mistakes
- Forgetting the base case, leading to infinite recursion.
Follow-up questions
- What is the space complexity?