Stacks and queues are defined by the order things come out. A stack is last in, first out: the most recent item is the next one returned, like a pile of plates or the undo history in an editor. A queue is first in, first out: items leave in the order they arrived, like a line at a counter or a print job list. Both are restricted on purpose, and that restriction is what makes them fast and easy to reason about.
This module starts with the two ideas side by side and how each can be built on top of an array or a linked list. It then looks closer at queues, including enqueue, dequeue and the circular queue that reuses freed space. A deque, a queue you can add to and remove from at both ends, is the natural next step once those basics are clear.
The last two lessons put a stack to work. Matching brackets is the classic first stack problem, and the monotonic stack turns a nested loop into a single pass for questions like "how many days until a warmer one". Watch the lessons in order, then continue on to Hash Tables & Sets.
An introduction to both data structures: LIFO and FIFO ordering, and a hands-on implementation of each.
Goes deeper on queues: the enqueue and dequeue operations, how a circular queue works, and implementations with code examples.
The classic first stack problem: checking that brackets open and close in the right order, solved step by step with a stack.
LeetCode 739 as a monotonic stack problem: for each day, find how long you wait for a warmer one, with the nested loop approach compared to the stack approach.