QueueEasy

IsEmpty & IsFull

Queue IsEmpty & IsFull Operations

Queue IsEmpty & IsFull Operations

Boundary state operations determine whether the queue has reached its limits of being completely empty or completely full.

1. IsEmpty

Checks if the queue is empty.

  • Rule: If the front index pointer is -1, it indicates that no elements have been enqueued yet, or the queue has been reset to an empty state after all elements were dequeued.
  • Return: Returns true if front == -1, otherwise returns false.

2. IsFull

Checks if the queue has reached its capacity.

  • Rule (Linear Queue): If the rear pointer is pointing to the final index of the array (rear == MAX - 1), then there is no memory remaining to perform another enqueue operation.
  • Return: Returns true if rear == MAX - 1, otherwise returns false.