SESK: Stuff Everyone Should Know · sesk.info/tech-stack-lifo
A stack is last-in, first-out. Which item comes off a stack first?
The most recently added item, like the top plate on a pile.
- The oldest item
- The most recently added item ✔
- The smallest item
Why: A stack only lets you add and remove at the top, so the newest item leaves first. A queue is the opposite: first in, first out, like a line at a store.
Huh, didn't know that: Your program's function calls live on a call stack, which is why the last function called is the first to finish.
I told a stack a secret. It came right back out, last in, first out.
Like this card?
References
Answer: The most recently added item. A stack only lets you add and remove at the top, so the newest item leaves first. A queue is the opposite: first in, first out, like a line at a store.
- Python Tutorial: Data Structures docs.python.org/3/tutorial/datastructures.html
a stack, where the last element added is the first element retrieved (“last-in, first-out”).
Checked 2026-10-10.
Think this answer is wrong? Tap "Challenge this answer" on the card in the game and tell us why.
More stuff everyone should know
That's stuff everyone should know.