Stack and Queue Visualiser

Push, pop, enqueue, and dequeue with animated step-by-step feedback. See exactly how LIFO and FIFO structures behave.

Stack LIFO - Last In, First Out
Queue FIFO - First In, First Out

Stack (LIFO)

Elements are added and removed from the same end - the top. The last element pushed is the first to be popped. Used in function call management, undo operations, and expression evaluation.

Push: O(1) Pop: O(1) Peek: O(1) Space: O(n)

Queue (FIFO)

Elements are added at the rear and removed from the front. The first element enqueued is the first to be dequeued. Used in scheduling, buffering, and breadth-first search.

Enqueue: O(1) Dequeue: O(1) Peek: O(1) Space: O(n)