Stacks
Lesson 9 of 20 · Algo.Micro
Last in, first out: undo, the call stack and balanced brackets.
A stack is a pile of plates: push puts an item on top, pop removes the top one. The last item in is the first out (LIFO). Both operations are O(1).
Check yourself
You push A, B, C and pop once. What comes out?
Do it in the browser: a real algorithms tool, a short mission and instant feedback. No install.
Start this lesson — free