What is a Queue? Explain Different Types of Queues ?


v  Queue is a linear data structure.
v  In queues insertion can take place at only one end called rear.
v  In queues deletions can takes place at the other end called front.
v  Queues are called FIFO(first in first out). The element first into the queue is the element deleted first from the queue.
v  Queues are also called LILO(last in last out).The element entered last into the queue is the element deleted last from the queue.

Operations performed on queues:

     1.    Insertion: inserting a new element into the queue.

     2.    Deletion : deleting a new element from the queue.

3.    Display : visit each node atleast once.
v  Queue is full- there is no room to insert a new element.
v  Queue is empty- there is no element to delete from queue.

Different types of queue:

            1. Abstract queue
            2. Queue
            3. Priority queue
            4. Circular queue
            5. De queue
Priority queue:

v  In priority queues while inserting an element we assign prority to that element.
v  While deleting we check two conditions.

1.    Highest priority element deleted first.
2.    While two elements have same priority the element entered first in to the queue is the deleted first then next.


Deletion order 22,11,44,33

Circular queues :

v  In circular queues last element next address shows first element address (front)
v  In circular queues first element previous address always shows last element address (rear).

DeQueue(double ended queue):

pronounced as deck.

Dequeues are two types.

v  Input restricted dequeue
v  Out put restricted dequeue

    1.    Input restricted dequeue:

  v  In input restricted dequeue we restrict insertion.
v  In Input restricted dequeue deletions can takes place both ends front as well as rear.
v  Insertions can take place only one end called rear.

input restricterd dequeue

    2.    Out put restricted dequeue

v  In Out put restricted dequeue we restrict deletion.
v  In Out put restricted dequeue insertions can takes place both place front as well as rear.
v  In Out put restricted dequeue deletion can takes place at only one end called front.

output restricterd dequeue


Data Structures 2087928358588640213

Post a Comment