Similar to the linked list ,Queue is also an Storage type data structure to store the data.Queue is also an Sequential type data structure.Queue have the following properties :
- Queue follow the FIRST COME FIRST SERVE (FCFS) or FIRST IN FIRST OUT (FIFO) or LAST IN LAST OUT (LILO) type serving strategy.
- FCFS means items will insert the first then delete the first. means if items came very early then those item will be serve very early.
- Insertion operation will apply at one end(rear or tail) and deletion operation will apply at another end(front or head).
- Insertion operation in Queue is called EnQueue.
- Deletion operation in Queue is called DeQueue.
- When Queue is empty ,and we want to delete the element (DeQueue) ,then this situation is called Underflow situation of Queue.
- When Queue is full and we want to insert an element (EnQueue),then this situation is called Overflow situation of Queue.
Queue in Real Life
- We noticed at the Railway ticket counter, there is line of people to take the tickets,this line is actually following the Queue,because if a person comes first then he will take the ticket first.
- At the Airport checkpoints ,there is the passengers Queue to check.
Operations of Queue
There are following some operation ,which can be applied on Queue :
- EnQueue : insertion of the Elements at the rear(tail) of the Queue.
- DeQueue : deletion of the Elements at the front(head) of the Queue.
- Searching : search for the specific elements
- QueueSize : counting the number of the elements.
- QueueStates : check the Queue is Empty or Full.
Applications of Queue
- Scheduling of Process to execute in Operating System.
- Ticket Counter of Railway platform and Bus-Stand.
- Used in Asynchronous data transfer like files I/O, Pipes and Sockets etc.
- Implementation of Multi programming.
- Queue can be used as a buffer storage.
- Queue used in Interrupts handling of Operating systems.
- Queue can also be used to implements another data structure like Stack data structure can be implement by Queue.
Queue Representations
We can implement the Queue by the using of following data structure :