Mark As Completed Discussion

1. Enqueue

The enqueue operation, as said earlier, adds elements to your queue from the rear end. Initially, when the queue is empty, both our front (sometimes called head) and rear (sometimes called tail) pointers are NULL.

Enqueue

Now, let's add an element-- say, 'a' to the queue. Both our front and rear now point to 'a'.

Enqueue

Let's add another element to our queue-- 'b'. Now, our front pointer remains the same, whereas the rear pointer points to 'b'. We'll add another item 'c' and you'll see that that element is also added at the rear end. Note that, a must somehow point to be internally, and b must point to c.

Enqueue