Stacks and queues are fundamental linear data structures that restrict access to elements in specific ways. A stack follows Last-In-First-Out (LIFO) semantics, while a queue follows First-In-First-Out (FIFO). Deques (double-ended queues) generalize both by allowing insertion and deletion at both ends. Monotonic queues are specialized variants that maintain elements in sorted order, enabling efficient sliding window maximum/minimum queries.
These structures are essential building blocks in algorithms, from expression evaluation and backtracking to breadth-first search and task scheduling. Understanding their variants and optimizations is crucial for efficient problem-solving.