Two of the simplest structures โ and they are running in the software you use right now.
Stack โ LIFO (last in, first out)
const stack = []; stack.push(x); // add on top stack.pop(); // remove from top stack[stack.length - 1]; // peek
In the wild: Ctrl+Z undo, browser back button, the JS call stack itself, matching brackets in every code editor, DFS traversal.
Queue โ FIFO (first in, first out)
const q = []; q.push(x); // enqueue at back q.shift(); // dequeue from front (O(n) on arrays โ fine for interviews)
In the wild: printer jobs, message queues (RabbitMQ/Kafka conceptually), Node's event queue, BFS traversal, rate limiters.
The interview classic
Valid Parentheses: push every opener; on a closer, pop and check it matches; valid = empty stack at the end. Solve it on our judge.
Follow-up they love
"Implement a queue using two stacks" โ push to stack A; to dequeue, pour A into B (reversing order) and pop B. Amortized O(1).