A queue is a non-primitive linear data structure which contains homogeneous collection of elements.
In queue elements are inserted from one end called rear end, and deleted from other end called front end.
A queue is a first in first out (FIFO) type of list.
Functionality of queue is similar to the queue we have seen on railway station reservation counter or ration shop. The person who comes first will be served first. The person served is removed from the front end and new person gets added in the queue from rear end.
Implementation of Queue
A queue can be implemented as:
Static queue implementation uses arrays. Here we must be aware about the number of the element that needs to be stored as size of the array is declared at the beginning.
Dynamic queue implementation uses Linked list and pointer.
Application of Queue
Round robin technique used in processor scheduling is implemented using queues.
Customer services like railway or air ticket reservation softwares are designed using queue to store the customers information.
Printer server routines are designed using queue.
Operation performed on the queue are:
insert item in the queue
delete item in th queue
We will learn queue implementation and operations in next chapters.