The Front Pointer
Points to the element that was added first (the oldest element). This is where all `Dequeue` operations occur. When you dequeue, the Front pointer moves forward.
Loading...
Loading Curriculum...
Loading Subject...
Loading Topic...
Loading Lesson...
Loading Lab...
Unlike Stacks which only need a single 'Top' pointer, Queues require two distinct pointers to manage their First-In-First-Out nature.
Points to the element that was added first (the oldest element). This is where all `Dequeue` operations occur. When you dequeue, the Front pointer moves forward.
Points to the element that was added last (the newest element). This is where all `Enqueue` operations occur. When you enqueue, the Rear pointer moves forward.
In a newly initialized array queue, both pointers usually start at `-1`. When the first item is added, both jump to `0`. If Front overtakes Rear (`Front > Rear`), the queue has become completely empty.