Queue is a linear data structure that follows a particular order in which the operations are performed for storing data. The order is First In First Out (FIFO). Basic Operations on Queue:
enqueue(): Inserts an element at the end of the queue i.e. at the rear end.
dequeue(): This operation removes and returns an element that is at the front end of the queue.
front(): This operation returns the element at the front end without removing it.
rear(): This operation returns the element at the rear end without removing it.
Algorithm:
1 − START
2 – Check if the queue is full.
3 − If the queue is full, produce overflow error and exit.
4 − If the queue is not full, increment rear pointer to point the next empty space.
5 − Add data element to the queue location, where the rear is pointing.
6 − return success.
7 – END
