Loading…
Loading…
Topic
Articles and problems tagged Stacks and Queues.
A complete application to finish the course: a parking garage whose lanes are linked-list queues, where a car leaving from the middle of a lane needs the cars in front of it moved out onto a stack and back. Combines queues, a stack, searching and careful pointer updates.
Two data structures every program relies on without seeing them: the circular queue that holds the keys you type before a program reads them, and the stack that remembers where each function call must return to. Simulate both, and see how recursion builds and unwinds stack frames.
In a circular linked list the last node links back to the first, so the list has no NULL end. Build a queue on a circular list, learn how to traverse a list that never ends, keep the circle closed on every deletion, and see why a single rear pointer is enough.
Build a stack (last in, first out), a queue (first in, first out) and a deque (both ends) on top of linked lists, so they can grow without a fixed size. Learn push, pop, enqueue and dequeue, why front and rear must stay in sync, and how to report an empty structure safely.