WorkspaceLearning path
Level 2 · Core Data Structures
BUILD YOUR INTUITION

Recursion

Solve a smaller instance and keep unfinished work in a call frame.

THE MENTAL MODEL

When should this come to mind?

Solve a smaller instance and keep unfinished work in a call frame.

Self-similar subproblemsTree traversalChoose, explore, undo

What makes it work

Every branch must reach a base case. Locals belong to individual frames.

When to choose something else

Very deep recursion can exceed the call stack; an explicit stack may be safer.

See the pattern in action

Change the input. Follow the state. Make it yours.