Stack

A stack follows last in, first out (LIFO). The most recently added item is the first item removed, like the top plate in a pile.

The queue in Queue handles reports by arrival time. Undo history needs a different order: after a specialist changes an assignee and then a priority, the priority change must be removed first.

undo_history = empty stack
push "Changed title" onto undo_history
action = pop the top item from undo_history

Push and pop operations at the top are usually O(1). Stacks are useful for undo history, nested function calls, parsing parentheses, and depth-first search.

The stack stores actions, not the current ticket or assignment queue. Recency and arrival order remain separate policies.

See Stack examples for runnable examples in supported programming languages.