Operations on a Queue

Subtitle


Queues have operations on them that allow for items to be removed and added from the queue.

Basic operations

Here is a basic queue with its pointers

ABCD
front=0rear=3

Adding (enqueue)

ABCDE
front=0rear=4

Removing (dequeue)

Note

The elements do not move.

BCDE
front=1rear=4

Other operations

  • isEmpty - Checks if the array is empty or not
  • isFull - Checks if the array is full or not