SlideShare a Scribd company logo
1 of 16
Sourav Mishra
1801353
1
QUEUE
•Queue is the linear data structure type which is
used to organize the data.
• It is used for temporary storage of data values.
•Anew element is added at one end called rear
end
•The existing element deleted from the other end
is called front end.
• First-in-First-out property.
2
Type of queue
Simple
Queue
Priority
Queue
Circular
Queue
Dequeue
(Double
ended
Queue)
3
Simple Queue
• Simple queue defines the simple operation of
queue in which insertion occurs at the rear of
the list and deletion occurs at the front of the
list.
4
Circular Queue
5
• In a circular queue, all nodes are treated as
circular. Last node is connected back to the
first node.
• Circular queue is also called as Ring Buffer.
• It is an abstract data type.
• Circular queue contains a collection of data
which allows insertion of data at the end of the
queue and deletion of data at the beginning of
the queue
x
6
Priority Queue
• Priority queue contains
data items which have
some preset priority.
While removing an
element from a priority
queue, the data item with
the highest priority is
removed first.
• In a priority queue,
insertion is performed in
the order of arrival and
deletion is performed
based on the priority.
7
Dequeue
(Double ended Queue)
• In Double Ended Queue, insert and delete
operation can be occur at both ends that is front
and rear of the queue
8
LINEAR
QUEUE
9
• A linear data structure that
stores data as a sequence of
element similar to a real
world queue.
• Possible to enter new items
from the rear end and
remove the items from the
front.
• Requires more memory.
• Less efficient.
CIRCULAR
QUEUE
• A linear data structure in
which the last item connects
back to the first item
forming a circle.
• Possible to enter and
remove elements from any
position.
• Requires less memory.
• More efficient.
Operations on Queue
10
• Enqueue() − add (store) an item to the queue.
• Dequeue() − remove (access) an item from the
queue.
• peek() − Gets the element at the front of the
queue without removing it.
• isfull() − Checks if the queue is full.
• isempty() − Checks if the queue is empty
Enqueue Operation
• Step 1 − Check if the queue
is full.
• Step 2 − If the queue is full,
produce overflow error and
exit.
• Step 3 − If the queue is not
full, increment rear pointer
to point the next empty
space.
• Step 4 − Add data element
to the queue location, where
the rear is pointing.
• Step 5 − return success.
11
Algorithm Of Enqueue
procedure enqueue(data)
if queue is full
return overflow
12
rear ← rear + 1
queue[rear] ← data
return true
end procedure
int enqueue (int data)
if(isfull())
return 0;
rear = rear + 1;
queue[rear] = data;
return 1;
end procedure
Example of
Enqueue
12
Dequeue Operation
• Step 1 − Check if the queue
is empty.
• Step 2 − If the queue is
empty, produce underflow
error and exit.
• Step 3 − If the queue is not
empty, access the data
where front is pointing.
• Step 4 −
Increment front pointer to
point to the next available
data element.
• Step 5 − Return success.
13
Algorithm for
dequeue operation
procedure dequeue
if queue is empty
return underflow
end if
data = queue[front]
front ← front + 1
return true
end procedure
Example of
Dequeue Operation
int dequeue()
{
if(isempty())
return 0;
int data = queue[front]; front =
front + 1;
return data;
}
14
Application of Queue
15
• Queue is useful in CPU scheduling, Disk
Scheduling.
• When data is transferred asynchronously
between two processes. Queue is used for
synchronization. Examples : IO Buffers, pipes,
file IO, etc.
• In real life, Call Center phone systems will use
Queues, to hold people calling them in an
order, until a service representative is free.
llllllj
16

More Related Content

Similar to queueppt-191018053228 (1).pptx

Similar to queueppt-191018053228 (1).pptx (20)

queue.pptx
queue.pptxqueue.pptx
queue.pptx
 
Stack and Queue.pptx
Stack and Queue.pptxStack and Queue.pptx
Stack and Queue.pptx
 
Queues
QueuesQueues
Queues
 
Queue Data Structure
Queue Data StructureQueue Data Structure
Queue Data Structure
 
Unit-ii-Queue ADT.pptx
Unit-ii-Queue ADT.pptxUnit-ii-Queue ADT.pptx
Unit-ii-Queue ADT.pptx
 
Queue
QueueQueue
Queue
 
Ist year Msc,2nd sem module1
Ist year Msc,2nd sem module1Ist year Msc,2nd sem module1
Ist year Msc,2nd sem module1
 
LEC4-DS ALGO.pdf
LEC4-DS  ALGO.pdfLEC4-DS  ALGO.pdf
LEC4-DS ALGO.pdf
 
Queue
QueueQueue
Queue
 
Stack and queue
Stack and queueStack and queue
Stack and queue
 
Stack.pptx
Stack.pptxStack.pptx
Stack.pptx
 
Queue - Data Structure - Notes
Queue - Data Structure - NotesQueue - Data Structure - Notes
Queue - Data Structure - Notes
 
Unit – iv queue
Unit – iv    queueUnit – iv    queue
Unit – iv queue
 
Data Structures
Data StructuresData Structures
Data Structures
 
Unit 4 queue
Unit   4 queueUnit   4 queue
Unit 4 queue
 
QUEUE.pptx
QUEUE.pptxQUEUE.pptx
QUEUE.pptx
 
Queue and its operations
Queue and its operationsQueue and its operations
Queue and its operations
 
Queue data structures and operation on data structures
Queue data structures and operation on data structuresQueue data structures and operation on data structures
Queue data structures and operation on data structures
 
stacks and queues for public
stacks and queues for publicstacks and queues for public
stacks and queues for public
 
Queue ADT for data structure for computer
Queue ADT for data structure for computerQueue ADT for data structure for computer
Queue ADT for data structure for computer
 

More from MeghaKulkarni27

Note for Java Programming////////////////
Note for Java Programming////////////////Note for Java Programming////////////////
Note for Java Programming////////////////MeghaKulkarni27
 
data structures and applications power p
data structures and applications power pdata structures and applications power p
data structures and applications power pMeghaKulkarni27
 
Different string operations....................
Different string operations....................Different string operations....................
Different string operations....................MeghaKulkarni27
 
virtual reality...............................
virtual reality...............................virtual reality...............................
virtual reality...............................MeghaKulkarni27
 
linkedlist-130914084342-phpapp02.pptx
linkedlist-130914084342-phpapp02.pptxlinkedlist-130914084342-phpapp02.pptx
linkedlist-130914084342-phpapp02.pptxMeghaKulkarni27
 
circularlinklist-190205164051.pptx
circularlinklist-190205164051.pptxcircularlinklist-190205164051.pptx
circularlinklist-190205164051.pptxMeghaKulkarni27
 

More from MeghaKulkarni27 (12)

Note for Java Programming////////////////
Note for Java Programming////////////////Note for Java Programming////////////////
Note for Java Programming////////////////
 
data structures and applications power p
data structures and applications power pdata structures and applications power p
data structures and applications power p
 
Different string operations....................
Different string operations....................Different string operations....................
Different string operations....................
 
virtual reality...............................
virtual reality...............................virtual reality...............................
virtual reality...............................
 
positive.pptx
positive.pptxpositive.pptx
positive.pptx
 
linkedlist-130914084342-phpapp02.pptx
linkedlist-130914084342-phpapp02.pptxlinkedlist-130914084342-phpapp02.pptx
linkedlist-130914084342-phpapp02.pptx
 
circularlinklist-190205164051.pptx
circularlinklist-190205164051.pptxcircularlinklist-190205164051.pptx
circularlinklist-190205164051.pptx
 
linkedlist.pptx
linkedlist.pptxlinkedlist.pptx
linkedlist.pptx
 
queue_final.pptx
queue_final.pptxqueue_final.pptx
queue_final.pptx
 
DS_PPT.pptx
DS_PPT.pptxDS_PPT.pptx
DS_PPT.pptx
 
stack.pptx
stack.pptxstack.pptx
stack.pptx
 
DS_PPT.ppt
DS_PPT.pptDS_PPT.ppt
DS_PPT.ppt
 

Recently uploaded

Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfAyushMahapatra5
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxVishalSingh1417
 
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...PsychoTech Services
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfagholdier
 
Disha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfDisha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfchloefrazer622
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfJayanti Pande
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Celine George
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAssociation for Project Management
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphThiyagu K
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...christianmathematics
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfAdmir Softic
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsTechSoup
 

Recently uploaded (20)

Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdf
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
Disha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfDisha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdf
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across Sectors
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 

queueppt-191018053228 (1).pptx

  • 2. QUEUE •Queue is the linear data structure type which is used to organize the data. • It is used for temporary storage of data values. •Anew element is added at one end called rear end •The existing element deleted from the other end is called front end. • First-in-First-out property. 2
  • 4. Simple Queue • Simple queue defines the simple operation of queue in which insertion occurs at the rear of the list and deletion occurs at the front of the list. 4
  • 5. Circular Queue 5 • In a circular queue, all nodes are treated as circular. Last node is connected back to the first node. • Circular queue is also called as Ring Buffer. • It is an abstract data type. • Circular queue contains a collection of data which allows insertion of data at the end of the queue and deletion of data at the beginning of the queue
  • 6. x 6
  • 7. Priority Queue • Priority queue contains data items which have some preset priority. While removing an element from a priority queue, the data item with the highest priority is removed first. • In a priority queue, insertion is performed in the order of arrival and deletion is performed based on the priority. 7
  • 8. Dequeue (Double ended Queue) • In Double Ended Queue, insert and delete operation can be occur at both ends that is front and rear of the queue 8
  • 9. LINEAR QUEUE 9 • A linear data structure that stores data as a sequence of element similar to a real world queue. • Possible to enter new items from the rear end and remove the items from the front. • Requires more memory. • Less efficient. CIRCULAR QUEUE • A linear data structure in which the last item connects back to the first item forming a circle. • Possible to enter and remove elements from any position. • Requires less memory. • More efficient.
  • 10. Operations on Queue 10 • Enqueue() − add (store) an item to the queue. • Dequeue() − remove (access) an item from the queue. • peek() − Gets the element at the front of the queue without removing it. • isfull() − Checks if the queue is full. • isempty() − Checks if the queue is empty
  • 11. Enqueue Operation • Step 1 − Check if the queue is full. • Step 2 − If the queue is full, produce overflow error and exit. • Step 3 − If the queue is not full, increment rear pointer to point the next empty space. • Step 4 − Add data element to the queue location, where the rear is pointing. • Step 5 − return success. 11
  • 12. Algorithm Of Enqueue procedure enqueue(data) if queue is full return overflow 12 rear ← rear + 1 queue[rear] ← data return true end procedure int enqueue (int data) if(isfull()) return 0; rear = rear + 1; queue[rear] = data; return 1; end procedure Example of Enqueue 12
  • 13. Dequeue Operation • Step 1 − Check if the queue is empty. • Step 2 − If the queue is empty, produce underflow error and exit. • Step 3 − If the queue is not empty, access the data where front is pointing. • Step 4 − Increment front pointer to point to the next available data element. • Step 5 − Return success. 13
  • 14. Algorithm for dequeue operation procedure dequeue if queue is empty return underflow end if data = queue[front] front ← front + 1 return true end procedure Example of Dequeue Operation int dequeue() { if(isempty()) return 0; int data = queue[front]; front = front + 1; return data; } 14
  • 15. Application of Queue 15 • Queue is useful in CPU scheduling, Disk Scheduling. • When data is transferred asynchronously between two processes. Queue is used for synchronization. Examples : IO Buffers, pipes, file IO, etc. • In real life, Call Center phone systems will use Queues, to hold people calling them in an order, until a service representative is free.