University Institute of Engineering Computer Science Engineering
University Institute of Engineering Computer Science Engineering
UNIVERSITY INSTITUTE OF
ENGINEERING
COMPUTER SCIENCE ENGINEERING
Bachelor of Engineering
Design and Analysis of
Algorithms(CSH-311/ITH-311)
Queues (CO2)
Queue
• Queue is a linear structure which follows a particular
order in which the operations are performed. The order
is First In First Out (FIFO). A good example of queue is
any queue of consumers for a resource where the
consumer that came first is served first.
Queues
• Stores a set of elements in a particular order
• Queue principle: FIRST IN FIRST OUT
• = FIFO
• It means: the first element inserted is the first one to be
removed
• Example
Queue Applications
Operations on Queue
Types of Queues
• Circular Queue
• Priority Queue
• De-queue
Circular Queue
DeQueue
• Double ended queue allows insertion and deletion from
both the ends i.e. elements can be added or removed
from rear as well as front end.
Priority Queue
• Priority queue is a type of queue where each element has
a priority value and the deletion of the elements is
depended upon the priority value. In case of max-priority
queue, the element will be deleted first which has the
largest priority value and in case of min-priority queue
the element will be deleted first which has the minimum
priority value.
REFERENCES
Text books:
•Cormen, Leiserson, Rivest, Stein, “Introduction to Algorithms”, Prentice Hall of
India, 3rd edition 2012. problem, Graph coloring.
•Horowitz, Sahni and Rajasekaran, “Fundamentals of ComputerAlgorithms”,
University Press (India), 2nd edition
Websites:
1.https://www.studytonight.com/data-structures/queue-data-structure
2.https://www.geeksforgeeks.org/queue-data-structure/
Summary
Queues:
•Types of queues
•Operations on queues