DS – Queue Operations

Static Queue:

  • We can use simple array with fixed size.
  • All operations need to perform using 2 variables Front and Rear.
  • Front is always pointing to Front location that is 0 index.

Declaration of stack as follows:

Inserting element into Queue:

  • To insert element into Queue, we need to check the Queue is Full or Not.
  • If Queue is full; we display error message “Queue is Overflow”.
  • If not, we insert the element from rear (using rear variable)

Deleting element from the Queue:

  • We delete element from the Queue.
  • Once we delete front element, we should not move “front” as front is Fixed in Linear Queue. 
  • All elements need to shift by one location towards front after deletion.

Display elements of Queue:

  • If Queue is Empty, we display the message “Queue is underflow”
  • If the Queue is non-empty, we display elements from Front to Rear.
Scroll to Top