Summary
A
stack stores items with
last_in_first_out order. Use
push to add to the
top,
pop to remove the top, and
peek to read the top without removing. Check emptiness with
is_empty and count items with
size. Removing from an empty stack is
underflow; adding beyond capacity is
overflow. Stacks appear in
function_calls,
recursion,
undo_redo, and
expression_parsing. Remember: the most recently pushed item is the first one popped.