0% found this document useful (0 votes)
10 views

Queue Notes

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views

Queue Notes

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

5.

Queue
1.Whatisqueue?
A Queue is definedas a lineardata structure that is open at both ends and the operations
are performed in First in First out (FIFO) order.
Queue is also an abstract data type or a linear data structure, just like stack data
structure, in which the first element is insertedfrom one end called the REAR(also
called tail), andthe removal of existing element takesplace from the other endcalled
as FRONT(also called head).
2.Listanytwoapplicationsofqueue?
Appliedaswaiting lists for a single shared resource like CPU,Disk, and Printer.
Appliedasbuffers on MP3 playersand portable CD players.
Appliedon Operating system to handle the interruption.
Appliedto adda song at the endor to play from the front.

3. What are the types of queue(imp)?


A queue is a useful data structure in programming. It is similar to the ticket queue
outside a cinema hall,where the first person entering the queue is the first person who
gets theticket.
There are four different types of queue.
a) Simple Queue
b) Circular Queue
c) Priority Queue
d) Double ended queue
SimpleQueue-In a simplequeue,insertion takes place at therear andremoval occurs at the
front. It strictly follows the FIFO(First in First out) rule.
CircularQueue-In a circular queue, thelast element points to the first element making a
circular link.
PriorityQueue-A priority queue is a special type of queue in which each element is
associated with a priority and is served according to its priority.If elementswith the
samepriority occur, they are servedaccording to their orderin the queue.
DoubleEndedQueue-In a double ended queue, insertion and removal of elements canbe
performed from either from the front or rear. Thus, it does not follow the FIFO(First in
First Out) rule.
4.What aretheapplicationsofqueue?
Enqueue: Adds an element to the rear of the queue.
Dequeue: Removesan element from the front of the queue.
IsEmpty: Checks if thequeue is empty.
IsFull: Checks if the queueis full (applies to fixed-sizequeues).

You might also like