Algorithms

Call stack

The memory area that stores a frame for each running function, with its variables and where to return. The last frame in is the first out.

Example

When computing a recursive f(3), the stack holds f(3), f(2) and f(1) at once. When f(1) finishes, its frame is removed and f(2) continues.

Test yourself: Call stack

Iteration and recursion

Why does recursion usually use more memory than a loop?

Lessons that use it

More algorithms terms

All terms →

Arki, the beaver mascot

Your next interview starts with 5 minutes today.

Free on iOS and Android. Start from zero, no account needed.