• Yastee A. Shah
By:
• 16IT148
ID NO.:
• Data Structure and Algorithm
(IT247)
Subject:
2
3
Introduction
■ A data structure is a particular way of organizing
data so that it can be used efficiently.
■ Different kind of data structure suits for the
different kind of applications.
■ Types:
Integer, Float, Pointer, Char (Primitive)
Array ,Tree, Graph, Linked list, Stack, Queue (Non-
primitive)
4
*http://jcsites.juniata.edu/faculty/kruse/cs240/queues.htm
What Makes a Structure
to be said “QUEUE”
■ Linear data structure.
■ Used for temporary storage of data values.
■ A new element is added at the end called Rear
End.
■ The existing elements deleted from the end
called Front End.
■ First-in-First-out property.
5
*http://jcsites.juniata.edu/faculty/kruse/cs240/queues.htm
Types Of Queue
■ Simple Queue
■ Circular Queue
■ Deque
■ Priority Queue
6
*https://courses.cs.washington.edu/courses/cse143/02au/slides/18b-
SAndQ-applications.pdf
Simple Queue
7
Circular Queue
When a resource is shared among multiple consumers.
1.Baggage carousel :
A group of advocates having a discussion on a round table or an
airport baggage carousel.
2.Traffic System:
In computer controlled traffic signals ,repeatedly shifting the lights
at regular intervals.
8
*https://www.geeksforgeeks.org/circular-queue-set-1-introduction-
array-implementation/
3.Round Robin Technique.
Disk Scheduling:
When data is transferred asynchronously (data not necessarily
received at same rate as sent) between two processes. Examples
include IO Buffers, pipes, file IO, etc.
CPU scheduling:
Operating Systems often maintain a queue of processes that are
ready to execute or are waiting for some event to occur.
9
4. Memory management:
The used memory locations in ordinary
queues can be in circular queues.
5.In case of printers and uploading
images.
10
Deque
APPLICATIONS
1.A-steal job scheduling Algorithm.
 The A-Steal algorithm implements task scheduling for
several processors(multiprocessor scheduling).
 The processor gets the first element from the deque.
 When one of the processor completes execution of its
own threads it can steal a thread from another processor.
 It gets the last element from the deque of another
processor and executes it.
11
*http://en.cppreference.com/w/cpp/container/deque
12
*National Energy Technology Laboratory, US Department
of Energy.
2.Undo-Redo operations in Software Application:
Deque is storing a software application's list of undo operations.
3. MoneyControl App:
It will show the stocks you last visited, it will remove the stocks
after some time and will add the latest ones.
4. To handle data that needs to be pruned after some time. Eg-
a browser's history.
The recently visited sites are added at one end, say the rear.
Now we obviously want a limit on the number of sites which are
stored in our history deque. So when that limit is reached, the
elements at the front are removed from the deque, to
accommodate new insertions. This is where a deque is useful
over a stack.
But we may also want to remove the newly visited sites at the
rear of our history deque. This is where a deque is useful over a
queue.
13
5.Palindrome- checker.
14
15
But I
came
FIRST…
But he
is
NAMO…
Priority Queue
First-in-first-out
Values come
out in order by priority!!!
It’s typically implemented using
Heap data structure.
16
Applications
1. Artificial Intelligence :
Finds the shortest path between two vertices of a weighted
graph, trying out the most promising routes first.
So, the fringe is used to keep track of unexplored routes, the
one for which a lower bound on the total path length is smallest
is given highest priority.
Prim's algorithm.
2. Using a priority queue to sort
17
*https://secweb.cs.odu.edu/~zeil/cs361/web/website/Lectures/priority
Queues/pages/ar01s02.html
18
3.Bandwidth Management:
Manage limited resources such as bandwidth on a
transmission line from a network router. In the event of
outgoing traffic queuing due to insufficient bandwidth,
all other queues can be halted to send the traffic from
the highest priority queue upon arrival. This ensures
that the prioritized traffic (such as real-time traffic, e.g.
an RTP stream of a VoIP connection) is forwarded with
the least delay and the least likelihood of being rejected
due to a queue reaching its maximum capacity. All other
traffic can be handled when the highest priority queue is
empty.
Usually a limitation is set to limit the bandwidth that
traffic from the highest priority queue can take, in order
to prevent high priority packets from choking off all
other traffic. Eg: Cisco Callmanager.
19
20
*http://www.cplusplus.com/reference/deque/deque/
21
22
23
Better Way??
Future of Queue
24
25

Application of Queue.pptx

  • 1.
    • Yastee A.Shah By: • 16IT148 ID NO.: • Data Structure and Algorithm (IT247) Subject:
  • 2.
  • 3.
  • 4.
    Introduction ■ A datastructure is a particular way of organizing data so that it can be used efficiently. ■ Different kind of data structure suits for the different kind of applications. ■ Types: Integer, Float, Pointer, Char (Primitive) Array ,Tree, Graph, Linked list, Stack, Queue (Non- primitive) 4 *http://jcsites.juniata.edu/faculty/kruse/cs240/queues.htm
  • 5.
    What Makes aStructure to be said “QUEUE” ■ Linear data structure. ■ Used for temporary storage of data values. ■ A new element is added at the end called Rear End. ■ The existing elements deleted from the end called Front End. ■ First-in-First-out property. 5 *http://jcsites.juniata.edu/faculty/kruse/cs240/queues.htm
  • 6.
    Types Of Queue ■Simple Queue ■ Circular Queue ■ Deque ■ Priority Queue 6 *https://courses.cs.washington.edu/courses/cse143/02au/slides/18b- SAndQ-applications.pdf
  • 7.
  • 8.
    Circular Queue When aresource is shared among multiple consumers. 1.Baggage carousel : A group of advocates having a discussion on a round table or an airport baggage carousel. 2.Traffic System: In computer controlled traffic signals ,repeatedly shifting the lights at regular intervals. 8 *https://www.geeksforgeeks.org/circular-queue-set-1-introduction- array-implementation/
  • 9.
    3.Round Robin Technique. DiskScheduling: When data is transferred asynchronously (data not necessarily received at same rate as sent) between two processes. Examples include IO Buffers, pipes, file IO, etc. CPU scheduling: Operating Systems often maintain a queue of processes that are ready to execute or are waiting for some event to occur. 9
  • 10.
    4. Memory management: Theused memory locations in ordinary queues can be in circular queues. 5.In case of printers and uploading images. 10
  • 11.
    Deque APPLICATIONS 1.A-steal job schedulingAlgorithm.  The A-Steal algorithm implements task scheduling for several processors(multiprocessor scheduling).  The processor gets the first element from the deque.  When one of the processor completes execution of its own threads it can steal a thread from another processor.  It gets the last element from the deque of another processor and executes it. 11 *http://en.cppreference.com/w/cpp/container/deque
  • 12.
    12 *National Energy TechnologyLaboratory, US Department of Energy. 2.Undo-Redo operations in Software Application: Deque is storing a software application's list of undo operations. 3. MoneyControl App: It will show the stocks you last visited, it will remove the stocks after some time and will add the latest ones.
  • 13.
    4. To handledata that needs to be pruned after some time. Eg- a browser's history. The recently visited sites are added at one end, say the rear. Now we obviously want a limit on the number of sites which are stored in our history deque. So when that limit is reached, the elements at the front are removed from the deque, to accommodate new insertions. This is where a deque is useful over a stack. But we may also want to remove the newly visited sites at the rear of our history deque. This is where a deque is useful over a queue. 13
  • 14.
  • 15.
  • 16.
    Priority Queue First-in-first-out Values come outin order by priority!!! It’s typically implemented using Heap data structure. 16
  • 17.
    Applications 1. Artificial Intelligence: Finds the shortest path between two vertices of a weighted graph, trying out the most promising routes first. So, the fringe is used to keep track of unexplored routes, the one for which a lower bound on the total path length is smallest is given highest priority. Prim's algorithm. 2. Using a priority queue to sort 17 *https://secweb.cs.odu.edu/~zeil/cs361/web/website/Lectures/priority Queues/pages/ar01s02.html
  • 18.
  • 19.
    3.Bandwidth Management: Manage limitedresources such as bandwidth on a transmission line from a network router. In the event of outgoing traffic queuing due to insufficient bandwidth, all other queues can be halted to send the traffic from the highest priority queue upon arrival. This ensures that the prioritized traffic (such as real-time traffic, e.g. an RTP stream of a VoIP connection) is forwarded with the least delay and the least likelihood of being rejected due to a queue reaching its maximum capacity. All other traffic can be handled when the highest priority queue is empty. Usually a limitation is set to limit the bandwidth that traffic from the highest priority queue can take, in order to prevent high priority packets from choking off all other traffic. Eg: Cisco Callmanager. 19
  • 20.
  • 21.
  • 22.
  • 23.
  • 24.
  • 25.