Data Structures
First observe the behavior in Explore mode, then switch to Apply to test each operation with intent.
A queue is a linear data structure following First-In-First-Out (FIFO) principle. Elements are added at the rear (enqueued) and removed from the front (dequeued).
FIFO (First-In-First-Out): First element added is first to be removed
Print Queue: Documents printed in order received
Elements enter from REAR and leave from FRONT in FIFO order.
Ready|Waiting for a queue operation
Time: Depends on operation|Space: O(1) auxiliary
Pseudocode
Queues are FIFO: the front leaves first, and new values join at the rear.
Explore mode: inspect FRONT and REAR to understand FIFO behavior.
Enqueue: Add element at rear → O(1)
FIFO (First-In-First-Out): First element added is first to be removed
In Apply mode, test one operation and explain its complexity before running the next.
Before clicking run, predict the next index/pointer movement and then verify it.