Introduction To Queue

                                Queue is a data structure where insertion happens at the rear side and deletion happens at the front side. Queue follows FIFO ( First In First Out ) i.e the element which is inserted first is the one which is dequeued , if the dequeue function is enabled. Initially the size of the queue must be initialized as it is a static data type. Some of the operations which can be done over queue are :
                 
   1. ENQUEUE - to insert an element into the queue at the rear end.
   2. DEQUEUE - to delete an element from the queue at the front end.
   3. GETREAR - to look on the rear element.
   4. GETFRONT - to look on the front element.
   5. ISEMPTY - to check whether the queue is empty or not.
   6. ISFULL - to check whether the queue is full or not.

APPILCATIONS:
                                1.cpu scheduling
                                2. disk scheduling
                                3.breadth first traversal in a tree,etc.

DISADVANTAGE:
                                  The disadvantage of queue is that when an element is dequeued at the front end , even though that slot is empty after dequeue operation , that slot can't be used for any other operation such as enqueue. It results in wastage of memory.

TYPES:
               1. circular queue
               2. priority queue


                                         


                                                
                                                         
Previous
Next Post »