SlideShare a Scribd company logo
1 of 14
QUEUE ADT IN DATA STRUCTURES
BY,
SUBHALAKSHMI.S
M.Sc(Computer Science)
Nadar saraswathi college of arts and science.
CONTENTS:
Queue ADT
Queue ADT Operations
Circular Queue
Linked List Based Implementation
Applications of Queues
Queue Abstract Data Type(ADT):
 It Insert at one end of List and remove at the other end.
 Queues are “FIFO” (first in first out).
Operations:
 The Primary operations are Enqueue and Dequeue.
 Enqueue - add an entry at the end of the queue (also called “rear” or “tail”).
 Dequeue - remove the entry from the front of the queue.
CIRCULAR QUEUE:
 Circular Queue is a linear data structure in which the operations are performed
based on FIFO(First In First Out).
 The last position is connected back to the first position to make a circle.
 It is also called ’Ring Buffer’.
 This function is used to insert an element into the circular queue.
Basic Features:
1.Incase of a circular queue, head pointer will always point to
front of the queue and tail pointer will always point to the end of the queue.
2.Initially, the head and tail pointers will be pointing to the
location, this would mean that the queue is empty.
3.New data is always added to the location pointed by the tail pointer, and
once the data is added tail pointer is incremented to point to the next available location.
4.In a circular queue, data is not actually removed from the queue. Only the
head pointer is incremented by one position when dequeue, is executed. As the queue
data is only the data between head and tail, hence the data left outside is not a part of
the queue anymore, hence removed.
5.The head and the tail pointer will get reinitialized to 0 every time they reach the end
of the queue.
6.Also, the head and tail pointers can across each other. In other words, head pointer
can be greater than the tail.
Linked List Based Implementation:
Pointer‐Based Implementation
 Can be implemented using linear linked list or circular linked list.
 Linear linked list
Need two external pointer (front and back)
• Circular linked list
Need only one pointer, that point at back.
Need 2 structure
 Declaration of the node
struct nodeQ {
char item;
nodeQ * next;
}
 Declaration of the queue
class queue
{public:
nodeQ *backPtr, * frontPtr;
// operations for queue
};
APPLICATIONS OF QUEUES:
 Printer Queue: Jobs submitted to a printer are printed in order of
arrival.
 Phone calls made to customer service hotlines are usually placed in a
queue.
 File servers: Users needing access to
their files on a shared file server machine are given access on a FIFO Basis.
Ds

More Related Content

What's hot

المحاضرة الثامنة: تراكيب البيانات الطابور
المحاضرة الثامنة: تراكيب البيانات الطابورالمحاضرة الثامنة: تراكيب البيانات الطابور
المحاضرة الثامنة: تراكيب البيانات الطابور
Mahmoud Alfarra
 

What's hot (20)

Implementation of queue using singly and doubly linked list.
Implementation of queue using singly and doubly linked list.Implementation of queue using singly and doubly linked list.
Implementation of queue using singly and doubly linked list.
 
Bca ii dfs u-2 linklist,stack,queue
Bca ii  dfs u-2 linklist,stack,queueBca ii  dfs u-2 linklist,stack,queue
Bca ii dfs u-2 linklist,stack,queue
 
Queue
QueueQueue
Queue
 
Data Structures 01
Data Structures 01Data Structures 01
Data Structures 01
 
Data Structures 2
Data Structures 2Data Structures 2
Data Structures 2
 
Sorting
SortingSorting
Sorting
 
02 Stack
02 Stack02 Stack
02 Stack
 
UNIT II LINEAR DATA STRUCTURES – STACKS, QUEUES
UNIT II 	LINEAR DATA STRUCTURES – STACKS, QUEUES	UNIT II 	LINEAR DATA STRUCTURES – STACKS, QUEUES
UNIT II LINEAR DATA STRUCTURES – STACKS, QUEUES
 
Queue Data Structure
Queue Data StructureQueue Data Structure
Queue Data Structure
 
queue & its applications
queue & its applicationsqueue & its applications
queue & its applications
 
Stack Data Structure
Stack Data StructureStack Data Structure
Stack Data Structure
 
Ppt presentation of queues
Ppt presentation of queuesPpt presentation of queues
Ppt presentation of queues
 
3 Array operations
3   Array operations3   Array operations
3 Array operations
 
Circular queue
Circular queueCircular queue
Circular queue
 
Stacks & Queues By Ms. Niti Arora
Stacks & Queues By Ms. Niti AroraStacks & Queues By Ms. Niti Arora
Stacks & Queues By Ms. Niti Arora
 
المحاضرة الثامنة: تراكيب البيانات الطابور
المحاضرة الثامنة: تراكيب البيانات الطابورالمحاضرة الثامنة: تراكيب البيانات الطابور
المحاضرة الثامنة: تراكيب البيانات الطابور
 
Queues
QueuesQueues
Queues
 
Queues
QueuesQueues
Queues
 
Ppt on Linked list,stack,queue
Ppt on Linked list,stack,queuePpt on Linked list,stack,queue
Ppt on Linked list,stack,queue
 
القوائم المترابطة Linked List باستخدام لغة جافا
القوائم المترابطة Linked List باستخدام لغة جافاالقوائم المترابطة Linked List باستخدام لغة جافا
القوائم المترابطة Linked List باستخدام لغة جافا
 

Similar to Ds

QUEUE in data-structure (classification, working procedure, Applications)
QUEUE in data-structure (classification, working procedure, Applications)QUEUE in data-structure (classification, working procedure, Applications)
QUEUE in data-structure (classification, working procedure, Applications)
Mehedi Hasan
 

Similar to Ds (20)

DSA Lab Manual C Scheme.pdf
DSA Lab Manual C Scheme.pdfDSA Lab Manual C Scheme.pdf
DSA Lab Manual C Scheme.pdf
 
circular_queue.pptx
circular_queue.pptxcircular_queue.pptx
circular_queue.pptx
 
Unit II - LINEAR DATA STRUCTURES
Unit II -  LINEAR DATA STRUCTURESUnit II -  LINEAR DATA STRUCTURES
Unit II - LINEAR DATA STRUCTURES
 
Difference between stack and queue
Difference between stack and queueDifference between stack and queue
Difference between stack and queue
 
VCE Unit 03vv.pptx
VCE Unit 03vv.pptxVCE Unit 03vv.pptx
VCE Unit 03vv.pptx
 
Queues
Queues Queues
Queues
 
QUEUE in data-structure (classification, working procedure, Applications)
QUEUE in data-structure (classification, working procedure, Applications)QUEUE in data-structure (classification, working procedure, Applications)
QUEUE in data-structure (classification, working procedure, Applications)
 
Stack and Queue
Stack and Queue Stack and Queue
Stack and Queue
 
05 queues
05 queues05 queues
05 queues
 
Stack & Queue
Stack & QueueStack & Queue
Stack & Queue
 
DS UNIT2QUEUES.pptx
DS UNIT2QUEUES.pptxDS UNIT2QUEUES.pptx
DS UNIT2QUEUES.pptx
 
unit 5 stack & queue.ppt
unit 5 stack & queue.pptunit 5 stack & queue.ppt
unit 5 stack & queue.ppt
 
Data structures
Data structuresData structures
Data structures
 
Linked list using Dynamic Memory Allocation
Linked list using Dynamic Memory AllocationLinked list using Dynamic Memory Allocation
Linked list using Dynamic Memory Allocation
 
queue.pptx
queue.pptxqueue.pptx
queue.pptx
 
stack.pptx
stack.pptxstack.pptx
stack.pptx
 
Queue
QueueQueue
Queue
 
Data Structures - Lecture 6 [queues]
Data Structures - Lecture 6 [queues]Data Structures - Lecture 6 [queues]
Data Structures - Lecture 6 [queues]
 
Chapter 7 ds
Chapter 7 dsChapter 7 ds
Chapter 7 ds
 
Fundamentals of Data Structure and Queues
Fundamentals of Data Structure and QueuesFundamentals of Data Structure and Queues
Fundamentals of Data Structure and Queues
 

More from Subha Selvam (14)

Digital image processing
Digital image processingDigital image processing
Digital image processing
 
Mobile computing
Mobile computingMobile computing
Mobile computing
 
Complier Design
Complier DesignComplier Design
Complier Design
 
Software engineering
Software engineeringSoftware engineering
Software engineering
 
Web programming
Web programmingWeb programming
Web programming
 
Big data
Big dataBig data
Big data
 
Data mining
Data miningData mining
Data mining
 
Operating system
Operating systemOperating system
Operating system
 
Database management
Database managementDatabase management
Database management
 
Database management
Database managementDatabase management
Database management
 
Computer network
Computer networkComputer network
Computer network
 
Mathematical foundation in cs
Mathematical foundation in csMathematical foundation in cs
Mathematical foundation in cs
 
Java
JavaJava
Java
 
Sc
ScSc
Sc
 

Recently uploaded

Uncommon Grace The Autobiography of Isaac Folorunso
Uncommon Grace The Autobiography of Isaac FolorunsoUncommon Grace The Autobiography of Isaac Folorunso
Uncommon Grace The Autobiography of Isaac Folorunso
Kayode Fayemi
 
If this Giant Must Walk: A Manifesto for a New Nigeria
If this Giant Must Walk: A Manifesto for a New NigeriaIf this Giant Must Walk: A Manifesto for a New Nigeria
If this Giant Must Walk: A Manifesto for a New Nigeria
Kayode Fayemi
 
No Advance 8868886958 Chandigarh Call Girls , Indian Call Girls For Full Nigh...
No Advance 8868886958 Chandigarh Call Girls , Indian Call Girls For Full Nigh...No Advance 8868886958 Chandigarh Call Girls , Indian Call Girls For Full Nigh...
No Advance 8868886958 Chandigarh Call Girls , Indian Call Girls For Full Nigh...
Sheetaleventcompany
 
Chiulli_Aurora_Oman_Raffaele_Beowulf.pptx
Chiulli_Aurora_Oman_Raffaele_Beowulf.pptxChiulli_Aurora_Oman_Raffaele_Beowulf.pptx
Chiulli_Aurora_Oman_Raffaele_Beowulf.pptx
raffaeleoman
 

Recently uploaded (20)

Air breathing and respiratory adaptations in diver animals
Air breathing and respiratory adaptations in diver animalsAir breathing and respiratory adaptations in diver animals
Air breathing and respiratory adaptations in diver animals
 
The workplace ecosystem of the future 24.4.2024 Fabritius_share ii.pdf
The workplace ecosystem of the future 24.4.2024 Fabritius_share ii.pdfThe workplace ecosystem of the future 24.4.2024 Fabritius_share ii.pdf
The workplace ecosystem of the future 24.4.2024 Fabritius_share ii.pdf
 
Re-membering the Bard: Revisiting The Compleat Wrks of Wllm Shkspr (Abridged)...
Re-membering the Bard: Revisiting The Compleat Wrks of Wllm Shkspr (Abridged)...Re-membering the Bard: Revisiting The Compleat Wrks of Wllm Shkspr (Abridged)...
Re-membering the Bard: Revisiting The Compleat Wrks of Wllm Shkspr (Abridged)...
 
Uncommon Grace The Autobiography of Isaac Folorunso
Uncommon Grace The Autobiography of Isaac FolorunsoUncommon Grace The Autobiography of Isaac Folorunso
Uncommon Grace The Autobiography of Isaac Folorunso
 
Dreaming Marissa Sánchez Music Video Treatment
Dreaming Marissa Sánchez Music Video TreatmentDreaming Marissa Sánchez Music Video Treatment
Dreaming Marissa Sánchez Music Video Treatment
 
Introduction to Prompt Engineering (Focusing on ChatGPT)
Introduction to Prompt Engineering (Focusing on ChatGPT)Introduction to Prompt Engineering (Focusing on ChatGPT)
Introduction to Prompt Engineering (Focusing on ChatGPT)
 
BDSM⚡Call Girls in Sector 97 Noida Escorts >༒8448380779 Escort Service
BDSM⚡Call Girls in Sector 97 Noida Escorts >༒8448380779 Escort ServiceBDSM⚡Call Girls in Sector 97 Noida Escorts >༒8448380779 Escort Service
BDSM⚡Call Girls in Sector 97 Noida Escorts >༒8448380779 Escort Service
 
VVIP Call Girls Nalasopara : 9892124323, Call Girls in Nalasopara Services
VVIP Call Girls Nalasopara : 9892124323, Call Girls in Nalasopara ServicesVVIP Call Girls Nalasopara : 9892124323, Call Girls in Nalasopara Services
VVIP Call Girls Nalasopara : 9892124323, Call Girls in Nalasopara Services
 
My Presentation "In Your Hands" by Halle Bailey
My Presentation "In Your Hands" by Halle BaileyMy Presentation "In Your Hands" by Halle Bailey
My Presentation "In Your Hands" by Halle Bailey
 
If this Giant Must Walk: A Manifesto for a New Nigeria
If this Giant Must Walk: A Manifesto for a New NigeriaIf this Giant Must Walk: A Manifesto for a New Nigeria
If this Giant Must Walk: A Manifesto for a New Nigeria
 
Busty Desi⚡Call Girls in Sector 51 Noida Escorts >༒8448380779 Escort Service-...
Busty Desi⚡Call Girls in Sector 51 Noida Escorts >༒8448380779 Escort Service-...Busty Desi⚡Call Girls in Sector 51 Noida Escorts >༒8448380779 Escort Service-...
Busty Desi⚡Call Girls in Sector 51 Noida Escorts >༒8448380779 Escort Service-...
 
No Advance 8868886958 Chandigarh Call Girls , Indian Call Girls For Full Nigh...
No Advance 8868886958 Chandigarh Call Girls , Indian Call Girls For Full Nigh...No Advance 8868886958 Chandigarh Call Girls , Indian Call Girls For Full Nigh...
No Advance 8868886958 Chandigarh Call Girls , Indian Call Girls For Full Nigh...
 
Thirunelveli call girls Tamil escorts 7877702510
Thirunelveli call girls Tamil escorts 7877702510Thirunelveli call girls Tamil escorts 7877702510
Thirunelveli call girls Tamil escorts 7877702510
 
Dreaming Music Video Treatment _ Project & Portfolio III
Dreaming Music Video Treatment _ Project & Portfolio IIIDreaming Music Video Treatment _ Project & Portfolio III
Dreaming Music Video Treatment _ Project & Portfolio III
 
Chiulli_Aurora_Oman_Raffaele_Beowulf.pptx
Chiulli_Aurora_Oman_Raffaele_Beowulf.pptxChiulli_Aurora_Oman_Raffaele_Beowulf.pptx
Chiulli_Aurora_Oman_Raffaele_Beowulf.pptx
 
BDSM⚡Call Girls in Sector 93 Noida Escorts >༒8448380779 Escort Service
BDSM⚡Call Girls in Sector 93 Noida Escorts >༒8448380779 Escort ServiceBDSM⚡Call Girls in Sector 93 Noida Escorts >༒8448380779 Escort Service
BDSM⚡Call Girls in Sector 93 Noida Escorts >༒8448380779 Escort Service
 
Call Girl Number in Khar Mumbai📲 9892124323 💞 Full Night Enjoy
Call Girl Number in Khar Mumbai📲 9892124323 💞 Full Night EnjoyCall Girl Number in Khar Mumbai📲 9892124323 💞 Full Night Enjoy
Call Girl Number in Khar Mumbai📲 9892124323 💞 Full Night Enjoy
 
Report Writing Webinar Training
Report Writing Webinar TrainingReport Writing Webinar Training
Report Writing Webinar Training
 
lONG QUESTION ANSWER PAKISTAN STUDIES10.
lONG QUESTION ANSWER PAKISTAN STUDIES10.lONG QUESTION ANSWER PAKISTAN STUDIES10.
lONG QUESTION ANSWER PAKISTAN STUDIES10.
 
ICT role in 21st century education and it's challenges.pdf
ICT role in 21st century education and it's challenges.pdfICT role in 21st century education and it's challenges.pdf
ICT role in 21st century education and it's challenges.pdf
 

Ds

  • 1. QUEUE ADT IN DATA STRUCTURES BY, SUBHALAKSHMI.S M.Sc(Computer Science) Nadar saraswathi college of arts and science.
  • 2. CONTENTS: Queue ADT Queue ADT Operations Circular Queue Linked List Based Implementation Applications of Queues
  • 3. Queue Abstract Data Type(ADT):  It Insert at one end of List and remove at the other end.  Queues are “FIFO” (first in first out).
  • 4. Operations:  The Primary operations are Enqueue and Dequeue.  Enqueue - add an entry at the end of the queue (also called “rear” or “tail”).  Dequeue - remove the entry from the front of the queue.
  • 5. CIRCULAR QUEUE:  Circular Queue is a linear data structure in which the operations are performed based on FIFO(First In First Out).  The last position is connected back to the first position to make a circle.  It is also called ’Ring Buffer’.  This function is used to insert an element into the circular queue.
  • 6.
  • 7. Basic Features: 1.Incase of a circular queue, head pointer will always point to front of the queue and tail pointer will always point to the end of the queue. 2.Initially, the head and tail pointers will be pointing to the location, this would mean that the queue is empty.
  • 8. 3.New data is always added to the location pointed by the tail pointer, and once the data is added tail pointer is incremented to point to the next available location. 4.In a circular queue, data is not actually removed from the queue. Only the head pointer is incremented by one position when dequeue, is executed. As the queue data is only the data between head and tail, hence the data left outside is not a part of the queue anymore, hence removed.
  • 9. 5.The head and the tail pointer will get reinitialized to 0 every time they reach the end of the queue.
  • 10. 6.Also, the head and tail pointers can across each other. In other words, head pointer can be greater than the tail. Linked List Based Implementation: Pointer‐Based Implementation  Can be implemented using linear linked list or circular linked list.  Linear linked list Need two external pointer (front and back)
  • 11. • Circular linked list Need only one pointer, that point at back. Need 2 structure  Declaration of the node struct nodeQ { char item; nodeQ * next; }
  • 12.  Declaration of the queue class queue {public: nodeQ *backPtr, * frontPtr; // operations for queue };
  • 13. APPLICATIONS OF QUEUES:  Printer Queue: Jobs submitted to a printer are printed in order of arrival.  Phone calls made to customer service hotlines are usually placed in a queue.  File servers: Users needing access to their files on a shared file server machine are given access on a FIFO Basis.