Stack & Queue
Fundamental linear data structures enforcing LIFO and FIFO access patterns.
Free theory articleFundamental linear data structures enforcing LIFO and FIFO access patterns.
Concept & interpretation
Stacks and Queues are fundamental linear data structures that organize data sequentially. They restrict where elements can be added or removed, which defines their behavior. A Stack operates on a Last-In, First-Out (LIFO) principle, similar to a stack of plates where you can only add or remove from the top. A Queue operates on a First-In, First-Out (FIFO) principle, much like a line of people waiting for service, where new arrivals join at the back and those at the front are served first.