SlideShare a Scribd company logo
LINKED LIST
IMPLEMENTATION OF
QUEUE
MODULE 3
1
IMPLEMENTING QUEUES USING
LINKED LISTS
• Allocate memory for each new element dynamically
• Link the queue elements together
• Use two pointers, Front and Rear, to mark the front and
rear of the queue
Dr. SINDHIA LINGASWAMY, VIT
2
• In a linked queue, every element has two parts, one that stores the
data and another that stores the address of the next element.
• The START pointer of the linked list is used as FRONT.
• Here, we will also use another pointer called REAR, which will store
the address of the last element in the queue.
• All insertions will be done at the rear end and all the deletions will
be done at the front end.
• If FRONT = REAR = NULL, then it indicates that the queue is empty.
Dr. SINDHIA LINGASWAMY, VIT
3
ENQUEUING (EMPTY
QUEUE)
 We need to make Front point to the new node
also
New Node
newNode
Dr. SINDHIA LINGASWAMY, VIT
4
FUNCTION ENQUEUE
Dr. SINDHIA LINGASWAMY, VIT
5
DEQUEUEING (THE QUEUE
CONTAINS ONLY ONE ELEMENT)
• We need to reset Rear to NULL also
Nod
e
qFront
qRear
After dequeue:
qFront = NULL
qRear = NULL
Dr. SINDHIA LINGASWAMY, VIT
6
Function Dequeue
Dr. SINDHIA LINGASWAMY, VIT
7

More Related Content

What's hot

Data Structure and Algorithms Linked List
Data Structure and Algorithms Linked ListData Structure and Algorithms Linked List
Data Structure and Algorithms Linked List
ManishPrajapati78
 
Linked List
Linked ListLinked List
Linked List
RaaviKapoor
 
Doubly Linked List
Doubly Linked ListDoubly Linked List
Doubly Linked List
Ninad Mankar
 
Circular link list.ppt
Circular link list.pptCircular link list.ppt
Circular link list.ppt
Tirthika Bandi
 
UNIT III NON LINEAR DATA STRUCTURES – TREES
UNIT III 	NON LINEAR DATA STRUCTURES – TREESUNIT III 	NON LINEAR DATA STRUCTURES – TREES
UNIT III NON LINEAR DATA STRUCTURES – TREES
Kathirvel Ayyaswamy
 
Tree in data structure
Tree in data structureTree in data structure
Tree in data structureghhgj jhgh
 
Singly linked list
Singly linked listSingly linked list
Singly linked list
Amar Jukuntla
 
Priority Queue in Data Structure
Priority Queue in Data StructurePriority Queue in Data Structure
Priority Queue in Data Structure
Meghaj Mallick
 
Doubly & Circular Linked Lists
Doubly & Circular Linked ListsDoubly & Circular Linked Lists
Doubly & Circular Linked Lists
Afaq Mansoor Khan
 
Queues
QueuesQueues
Doubly Linked List
Doubly Linked ListDoubly Linked List
Binary trees1
Binary trees1Binary trees1
Binary trees1
Saurabh Mishra
 
Linked List, Types of Linked LIst, Various Operations, Applications of Linked...
Linked List, Types of Linked LIst, Various Operations, Applications of Linked...Linked List, Types of Linked LIst, Various Operations, Applications of Linked...
Linked List, Types of Linked LIst, Various Operations, Applications of Linked...
Balwant Gorad
 
Avl trees
Avl treesAvl trees
Avl trees
amna izzat
 
Data Structure (Queue)
Data Structure (Queue)Data Structure (Queue)
Data Structure (Queue)
Adam Mukharil Bachtiar
 
linked list in data structure
linked list in data structure linked list in data structure
linked list in data structure
shameen khan
 
Binary tree
Binary tree Binary tree
Binary tree
Rajendran
 
Linked List
Linked ListLinked List
Linked List
CHANDAN KUMAR
 

What's hot (20)

AVL Tree
AVL TreeAVL Tree
AVL Tree
 
Data Structure and Algorithms Linked List
Data Structure and Algorithms Linked ListData Structure and Algorithms Linked List
Data Structure and Algorithms Linked List
 
Linked List
Linked ListLinked List
Linked List
 
Doubly Linked List
Doubly Linked ListDoubly Linked List
Doubly Linked List
 
Circular link list.ppt
Circular link list.pptCircular link list.ppt
Circular link list.ppt
 
UNIT III NON LINEAR DATA STRUCTURES – TREES
UNIT III 	NON LINEAR DATA STRUCTURES – TREESUNIT III 	NON LINEAR DATA STRUCTURES – TREES
UNIT III NON LINEAR DATA STRUCTURES – TREES
 
Tree in data structure
Tree in data structureTree in data structure
Tree in data structure
 
Singly linked list
Singly linked listSingly linked list
Singly linked list
 
Priority Queue in Data Structure
Priority Queue in Data StructurePriority Queue in Data Structure
Priority Queue in Data Structure
 
Doubly & Circular Linked Lists
Doubly & Circular Linked ListsDoubly & Circular Linked Lists
Doubly & Circular Linked Lists
 
Queues
QueuesQueues
Queues
 
Doubly Linked List
Doubly Linked ListDoubly Linked List
Doubly Linked List
 
Binary trees1
Binary trees1Binary trees1
Binary trees1
 
Linked List, Types of Linked LIst, Various Operations, Applications of Linked...
Linked List, Types of Linked LIst, Various Operations, Applications of Linked...Linked List, Types of Linked LIst, Various Operations, Applications of Linked...
Linked List, Types of Linked LIst, Various Operations, Applications of Linked...
 
Avl trees
Avl treesAvl trees
Avl trees
 
Data Structure (Queue)
Data Structure (Queue)Data Structure (Queue)
Data Structure (Queue)
 
linked list in data structure
linked list in data structure linked list in data structure
linked list in data structure
 
single linked list
single linked listsingle linked list
single linked list
 
Binary tree
Binary tree Binary tree
Binary tree
 
Linked List
Linked ListLinked List
Linked List
 

Similar to Linked list implementation of Queue

ds-lecture-4-171012041008 (1).pdf
ds-lecture-4-171012041008 (1).pdfds-lecture-4-171012041008 (1).pdf
ds-lecture-4-171012041008 (1).pdf
KamranAli649587
 
Linked list implementation of Stack
Linked list implementation of StackLinked list implementation of Stack
Linked list implementation of Stack
Dr. Sindhia Lingaswamy
 
DS Module 03.pdf
DS Module 03.pdfDS Module 03.pdf
DS Module 03.pdf
SonaPathak5
 
Linked list (1).pptx
Linked list (1).pptxLinked list (1).pptx
Linked list (1).pptx
rajveersingh643731
 
Stacks and Queues with Linked List.pdf
Stacks and Queues with Linked List.pdfStacks and Queues with Linked List.pdf
Stacks and Queues with Linked List.pdf
GKalyani4
 
DSModule2.pptx
DSModule2.pptxDSModule2.pptx
DSModule2.pptx
ChrisSosaJacob
 
Linkedlists
LinkedlistsLinkedlists
Linkedlists
Rajendran
 
Linked list
Linked listLinked list
data structures and applications power p
data structures and applications power pdata structures and applications power p
data structures and applications power p
MeghaKulkarni27
 
Ppt on Linked list,stack,queue
Ppt on Linked list,stack,queuePpt on Linked list,stack,queue
Ppt on Linked list,stack,queue
Srajan Shukla
 
Data Structures 3
Data Structures 3Data Structures 3
Data Structures 3
Dr.Umadevi V
 
10994103.ppt
10994103.ppt10994103.ppt
10994103.ppt
SushmaG48
 
header, circular and two way linked lists
header, circular and two way linked listsheader, circular and two way linked lists
header, circular and two way linked lists
student
 
VCE Unit 02 (1).pptx
VCE Unit 02 (1).pptxVCE Unit 02 (1).pptx
VCE Unit 02 (1).pptx
skilljiolms
 
mbit_Unit-2_Linked List.pptx
mbit_Unit-2_Linked List.pptxmbit_Unit-2_Linked List.pptx
mbit_Unit-2_Linked List.pptx
jotaro11
 
unit 2- PPT.pdf
unit 2- PPT.pdfunit 2- PPT.pdf
unit 2- PPT.pdf
PranavMakwana6
 
unit 1.pptx
unit 1.pptxunit 1.pptx
unit 1.pptx
ssuser7922b8
 
5.Linked list
5.Linked list 5.Linked list
5.Linked list
Mandeep Singh
 
Dounly linked list
Dounly linked listDounly linked list
Dounly linked list
NirmalPandey23
 
Bca data structures linked list mrs.sowmya jyothi
Bca data structures linked list mrs.sowmya jyothiBca data structures linked list mrs.sowmya jyothi
Bca data structures linked list mrs.sowmya jyothi
Sowmya Jyothi
 

Similar to Linked list implementation of Queue (20)

ds-lecture-4-171012041008 (1).pdf
ds-lecture-4-171012041008 (1).pdfds-lecture-4-171012041008 (1).pdf
ds-lecture-4-171012041008 (1).pdf
 
Linked list implementation of Stack
Linked list implementation of StackLinked list implementation of Stack
Linked list implementation of Stack
 
DS Module 03.pdf
DS Module 03.pdfDS Module 03.pdf
DS Module 03.pdf
 
Linked list (1).pptx
Linked list (1).pptxLinked list (1).pptx
Linked list (1).pptx
 
Stacks and Queues with Linked List.pdf
Stacks and Queues with Linked List.pdfStacks and Queues with Linked List.pdf
Stacks and Queues with Linked List.pdf
 
DSModule2.pptx
DSModule2.pptxDSModule2.pptx
DSModule2.pptx
 
Linkedlists
LinkedlistsLinkedlists
Linkedlists
 
Linked list
Linked listLinked list
Linked list
 
data structures and applications power p
data structures and applications power pdata structures and applications power p
data structures and applications power p
 
Ppt on Linked list,stack,queue
Ppt on Linked list,stack,queuePpt on Linked list,stack,queue
Ppt on Linked list,stack,queue
 
Data Structures 3
Data Structures 3Data Structures 3
Data Structures 3
 
10994103.ppt
10994103.ppt10994103.ppt
10994103.ppt
 
header, circular and two way linked lists
header, circular and two way linked listsheader, circular and two way linked lists
header, circular and two way linked lists
 
VCE Unit 02 (1).pptx
VCE Unit 02 (1).pptxVCE Unit 02 (1).pptx
VCE Unit 02 (1).pptx
 
mbit_Unit-2_Linked List.pptx
mbit_Unit-2_Linked List.pptxmbit_Unit-2_Linked List.pptx
mbit_Unit-2_Linked List.pptx
 
unit 2- PPT.pdf
unit 2- PPT.pdfunit 2- PPT.pdf
unit 2- PPT.pdf
 
unit 1.pptx
unit 1.pptxunit 1.pptx
unit 1.pptx
 
5.Linked list
5.Linked list 5.Linked list
5.Linked list
 
Dounly linked list
Dounly linked listDounly linked list
Dounly linked list
 
Bca data structures linked list mrs.sowmya jyothi
Bca data structures linked list mrs.sowmya jyothiBca data structures linked list mrs.sowmya jyothi
Bca data structures linked list mrs.sowmya jyothi
 

Recently uploaded

A case study of cinema management system project report..pdf
A case study of cinema management system project report..pdfA case study of cinema management system project report..pdf
A case study of cinema management system project report..pdf
Kamal Acharya
 
Construction method of steel structure space frame .pptx
Construction method of steel structure space frame .pptxConstruction method of steel structure space frame .pptx
Construction method of steel structure space frame .pptx
wendy cai
 
Final project report on grocery store management system..pdf
Final project report on grocery store management system..pdfFinal project report on grocery store management system..pdf
Final project report on grocery store management system..pdf
Kamal Acharya
 
Halogenation process of chemical process industries
Halogenation process of chemical process industriesHalogenation process of chemical process industries
Halogenation process of chemical process industries
MuhammadTufail242431
 
CME397 Surface Engineering- Professional Elective
CME397 Surface Engineering- Professional ElectiveCME397 Surface Engineering- Professional Elective
CME397 Surface Engineering- Professional Elective
karthi keyan
 
Top 13 Famous Civil Engineering Scientist
Top 13 Famous Civil Engineering ScientistTop 13 Famous Civil Engineering Scientist
Top 13 Famous Civil Engineering Scientist
gettygaming1
 
Democratizing Fuzzing at Scale by Abhishek Arya
Democratizing Fuzzing at Scale by Abhishek AryaDemocratizing Fuzzing at Scale by Abhishek Arya
Democratizing Fuzzing at Scale by Abhishek Arya
abh.arya
 
Online resume builder management system project report.pdf
Online resume builder management system project report.pdfOnline resume builder management system project report.pdf
Online resume builder management system project report.pdf
Kamal Acharya
 
ENERGY STORAGE DEVICES INTRODUCTION UNIT-I
ENERGY STORAGE DEVICES  INTRODUCTION UNIT-IENERGY STORAGE DEVICES  INTRODUCTION UNIT-I
ENERGY STORAGE DEVICES INTRODUCTION UNIT-I
VigneshvaranMech
 
Scaling in conventional MOSFET for constant electric field and constant voltage
Scaling in conventional MOSFET for constant electric field and constant voltageScaling in conventional MOSFET for constant electric field and constant voltage
Scaling in conventional MOSFET for constant electric field and constant voltage
RCC Institute of Information Technology
 
Natalia Rutkowska - BIM School Course in Kraków
Natalia Rutkowska - BIM School Course in KrakówNatalia Rutkowska - BIM School Course in Kraków
Natalia Rutkowska - BIM School Course in Kraków
bim.edu.pl
 
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdfHybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
fxintegritypublishin
 
fundamentals of drawing and isometric and orthographic projection
fundamentals of drawing and isometric and orthographic projectionfundamentals of drawing and isometric and orthographic projection
fundamentals of drawing and isometric and orthographic projection
jeevanprasad8
 
RS Khurmi Machine Design Clutch and Brake Exercise Numerical Solutions
RS Khurmi Machine Design Clutch and Brake Exercise Numerical SolutionsRS Khurmi Machine Design Clutch and Brake Exercise Numerical Solutions
RS Khurmi Machine Design Clutch and Brake Exercise Numerical Solutions
Atif Razi
 
Standard Reomte Control Interface - Neometrix
Standard Reomte Control Interface - NeometrixStandard Reomte Control Interface - Neometrix
Standard Reomte Control Interface - Neometrix
Neometrix_Engineering_Pvt_Ltd
 
Danfoss NeoCharge Technology -A Revolution in 2024.pdf
Danfoss NeoCharge Technology -A Revolution in 2024.pdfDanfoss NeoCharge Technology -A Revolution in 2024.pdf
Danfoss NeoCharge Technology -A Revolution in 2024.pdf
NurvisNavarroSanchez
 
Online blood donation management system project.pdf
Online blood donation management system project.pdfOnline blood donation management system project.pdf
Online blood donation management system project.pdf
Kamal Acharya
 
Vaccine management system project report documentation..pdf
Vaccine management system project report documentation..pdfVaccine management system project report documentation..pdf
Vaccine management system project report documentation..pdf
Kamal Acharya
 
İTÜ CAD and Reverse Engineering Workshop
İTÜ CAD and Reverse Engineering WorkshopİTÜ CAD and Reverse Engineering Workshop
İTÜ CAD and Reverse Engineering Workshop
Emre Günaydın
 
Explosives Industry manufacturing process.pdf
Explosives Industry manufacturing process.pdfExplosives Industry manufacturing process.pdf
Explosives Industry manufacturing process.pdf
884710SadaqatAli
 

Recently uploaded (20)

A case study of cinema management system project report..pdf
A case study of cinema management system project report..pdfA case study of cinema management system project report..pdf
A case study of cinema management system project report..pdf
 
Construction method of steel structure space frame .pptx
Construction method of steel structure space frame .pptxConstruction method of steel structure space frame .pptx
Construction method of steel structure space frame .pptx
 
Final project report on grocery store management system..pdf
Final project report on grocery store management system..pdfFinal project report on grocery store management system..pdf
Final project report on grocery store management system..pdf
 
Halogenation process of chemical process industries
Halogenation process of chemical process industriesHalogenation process of chemical process industries
Halogenation process of chemical process industries
 
CME397 Surface Engineering- Professional Elective
CME397 Surface Engineering- Professional ElectiveCME397 Surface Engineering- Professional Elective
CME397 Surface Engineering- Professional Elective
 
Top 13 Famous Civil Engineering Scientist
Top 13 Famous Civil Engineering ScientistTop 13 Famous Civil Engineering Scientist
Top 13 Famous Civil Engineering Scientist
 
Democratizing Fuzzing at Scale by Abhishek Arya
Democratizing Fuzzing at Scale by Abhishek AryaDemocratizing Fuzzing at Scale by Abhishek Arya
Democratizing Fuzzing at Scale by Abhishek Arya
 
Online resume builder management system project report.pdf
Online resume builder management system project report.pdfOnline resume builder management system project report.pdf
Online resume builder management system project report.pdf
 
ENERGY STORAGE DEVICES INTRODUCTION UNIT-I
ENERGY STORAGE DEVICES  INTRODUCTION UNIT-IENERGY STORAGE DEVICES  INTRODUCTION UNIT-I
ENERGY STORAGE DEVICES INTRODUCTION UNIT-I
 
Scaling in conventional MOSFET for constant electric field and constant voltage
Scaling in conventional MOSFET for constant electric field and constant voltageScaling in conventional MOSFET for constant electric field and constant voltage
Scaling in conventional MOSFET for constant electric field and constant voltage
 
Natalia Rutkowska - BIM School Course in Kraków
Natalia Rutkowska - BIM School Course in KrakówNatalia Rutkowska - BIM School Course in Kraków
Natalia Rutkowska - BIM School Course in Kraków
 
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdfHybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
 
fundamentals of drawing and isometric and orthographic projection
fundamentals of drawing and isometric and orthographic projectionfundamentals of drawing and isometric and orthographic projection
fundamentals of drawing and isometric and orthographic projection
 
RS Khurmi Machine Design Clutch and Brake Exercise Numerical Solutions
RS Khurmi Machine Design Clutch and Brake Exercise Numerical SolutionsRS Khurmi Machine Design Clutch and Brake Exercise Numerical Solutions
RS Khurmi Machine Design Clutch and Brake Exercise Numerical Solutions
 
Standard Reomte Control Interface - Neometrix
Standard Reomte Control Interface - NeometrixStandard Reomte Control Interface - Neometrix
Standard Reomte Control Interface - Neometrix
 
Danfoss NeoCharge Technology -A Revolution in 2024.pdf
Danfoss NeoCharge Technology -A Revolution in 2024.pdfDanfoss NeoCharge Technology -A Revolution in 2024.pdf
Danfoss NeoCharge Technology -A Revolution in 2024.pdf
 
Online blood donation management system project.pdf
Online blood donation management system project.pdfOnline blood donation management system project.pdf
Online blood donation management system project.pdf
 
Vaccine management system project report documentation..pdf
Vaccine management system project report documentation..pdfVaccine management system project report documentation..pdf
Vaccine management system project report documentation..pdf
 
İTÜ CAD and Reverse Engineering Workshop
İTÜ CAD and Reverse Engineering WorkshopİTÜ CAD and Reverse Engineering Workshop
İTÜ CAD and Reverse Engineering Workshop
 
Explosives Industry manufacturing process.pdf
Explosives Industry manufacturing process.pdfExplosives Industry manufacturing process.pdf
Explosives Industry manufacturing process.pdf
 

Linked list implementation of Queue

  • 2. IMPLEMENTING QUEUES USING LINKED LISTS • Allocate memory for each new element dynamically • Link the queue elements together • Use two pointers, Front and Rear, to mark the front and rear of the queue Dr. SINDHIA LINGASWAMY, VIT 2
  • 3. • In a linked queue, every element has two parts, one that stores the data and another that stores the address of the next element. • The START pointer of the linked list is used as FRONT. • Here, we will also use another pointer called REAR, which will store the address of the last element in the queue. • All insertions will be done at the rear end and all the deletions will be done at the front end. • If FRONT = REAR = NULL, then it indicates that the queue is empty. Dr. SINDHIA LINGASWAMY, VIT 3
  • 4. ENQUEUING (EMPTY QUEUE)  We need to make Front point to the new node also New Node newNode Dr. SINDHIA LINGASWAMY, VIT 4
  • 5. FUNCTION ENQUEUE Dr. SINDHIA LINGASWAMY, VIT 5
  • 6. DEQUEUEING (THE QUEUE CONTAINS ONLY ONE ELEMENT) • We need to reset Rear to NULL also Nod e qFront qRear After dequeue: qFront = NULL qRear = NULL Dr. SINDHIA LINGASWAMY, VIT 6
  • 7. Function Dequeue Dr. SINDHIA LINGASWAMY, VIT 7