Stack (LIFO)
Push and pop happen at the same end, so the last item in is the first out. Stacks model nested structure: matching brackets, undo history, depth-first traversal, and the function call stack. All operations are O(1).
Queue (FIFO) & deque
Items leave in arrival order. Queues drive breadth-first search and task scheduling. A naive array `shift()` is O(n); use a linked list or two-stack/index-based ring buffer for O(1) dequeue. A deque allows O(1) at both ends and underlies sliding-window-maximum solutions.