SlideShare a Scribd company logo
2
Most read
3
Most read
5
Most read
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
Ad

Recommended

Queue in Data Structure
Queue in Data Structure
Janki Shah
 
Stack
Stack
srihariyenduri
 
Parameter passing to_functions_in_c
Parameter passing to_functions_in_c
ForwardBlog Enewzletter
 
Energy bands and gaps in semiconductor
Energy bands and gaps in semiconductor
Ganapathirao Kandregula
 
Quick sort-Data Structure
Quick sort-Data Structure
Jeanie Arnoco
 
Quick sort
Quick sort
Jehat Hassan
 
Linked list
Linked list
KalaivaniKS1
 
Doubly Linked List
Doubly Linked List
Ninad Mankar
 
Binary Tree in Data Structure
Binary Tree in Data Structure
Meghaj Mallick
 
Singly linked list
Singly linked list
Amar Jukuntla
 
sparse matrix in data structure
sparse matrix in data structure
MAHALAKSHMI P
 
Searching techniques in Data Structure And Algorithm
Searching techniques in Data Structure And Algorithm
03446940736
 
Queues
Queues
Ashim Lamichhane
 
Linked lists
Linked lists
SARITHA REDDY
 
Queue
Queue
Allana Institute of management sciences
 
Chapter 11 - Sorting and Searching
Chapter 11 - Sorting and Searching
Eduardo Bergavera
 
Doubly Linked List
Doubly Linked List
V.V.Vanniaperumal College for Women
 
Threaded Binary Tree.pptx
Threaded Binary Tree.pptx
pavankumarjakkepalli
 
Binary search tree operations
Binary search tree operations
Kamran Zafar
 
Bubble sort
Bubble sort
Rashmi R Upadhya
 
linear search and binary search
linear search and binary search
Zia Ush Shamszaman
 
Binary Search - Design & Analysis of Algorithms
Binary Search - Design & Analysis of Algorithms
Drishti Bhalla
 
Quick Sort , Merge Sort , Heap Sort
Quick Sort , Merge Sort , Heap Sort
Mohammed Hussein
 
THREADED BINARY TREE AND BINARY SEARCH TREE
THREADED BINARY TREE AND BINARY SEARCH TREE
Siddhi Shrivas
 
Binary search tree(bst)
Binary search tree(bst)
Hossain Md Shakhawat
 
Circular linked list
Circular linked list
chauhankapil
 
Stack and queue
Stack and queue
CHANDAN KUMAR
 
Array data structure
Array data structure
maamir farooq
 
ds-lecture-4-171012041008 (1).pdf
ds-lecture-4-171012041008 (1).pdf
KamranAli649587
 
Linked list implementation of Stack
Linked list implementation of Stack
Dr. Sindhia Lingaswamy
 

More Related Content

What's hot (20)

Binary Tree in Data Structure
Binary Tree in Data Structure
Meghaj Mallick
 
Singly linked list
Singly linked list
Amar Jukuntla
 
sparse matrix in data structure
sparse matrix in data structure
MAHALAKSHMI P
 
Searching techniques in Data Structure And Algorithm
Searching techniques in Data Structure And Algorithm
03446940736
 
Queues
Queues
Ashim Lamichhane
 
Linked lists
Linked lists
SARITHA REDDY
 
Queue
Queue
Allana Institute of management sciences
 
Chapter 11 - Sorting and Searching
Chapter 11 - Sorting and Searching
Eduardo Bergavera
 
Doubly Linked List
Doubly Linked List
V.V.Vanniaperumal College for Women
 
Threaded Binary Tree.pptx
Threaded Binary Tree.pptx
pavankumarjakkepalli
 
Binary search tree operations
Binary search tree operations
Kamran Zafar
 
Bubble sort
Bubble sort
Rashmi R Upadhya
 
linear search and binary search
linear search and binary search
Zia Ush Shamszaman
 
Binary Search - Design & Analysis of Algorithms
Binary Search - Design & Analysis of Algorithms
Drishti Bhalla
 
Quick Sort , Merge Sort , Heap Sort
Quick Sort , Merge Sort , Heap Sort
Mohammed Hussein
 
THREADED BINARY TREE AND BINARY SEARCH TREE
THREADED BINARY TREE AND BINARY SEARCH TREE
Siddhi Shrivas
 
Binary search tree(bst)
Binary search tree(bst)
Hossain Md Shakhawat
 
Circular linked list
Circular linked list
chauhankapil
 
Stack and queue
Stack and queue
CHANDAN KUMAR
 
Array data structure
Array data structure
maamir farooq
 

Similar to Linked list implementation of Queue (20)

ds-lecture-4-171012041008 (1).pdf
ds-lecture-4-171012041008 (1).pdf
KamranAli649587
 
Linked list implementation of Stack
Linked list implementation of Stack
Dr. Sindhia Lingaswamy
 
DS Module 03.pdf
DS Module 03.pdf
SonaPathak5
 
RPT_03_A_Linked List presentation for FE
RPT_03_A_Linked List presentation for FE
AshishFamt
 
linked list in data structure
linked list in data structure
shameen khan
 
Linked list (1).pptx
Linked list (1).pptx
rajveersingh643731
 
Stacks and Queues with Linked List.pdf
Stacks and Queues with Linked List.pdf
GKalyani4
 
DSModule2.pptx
DSModule2.pptx
ChrisSosaJacob
 
Queues
Queues
Lovely Professional University
 
DS10-QUEUE0000000000000000000000000000000000000.pptx
DS10-QUEUE0000000000000000000000000000000000000.pptx
ProfVMGawde
 
Linkedlists
Linkedlists
Rajendran
 
Linked list
Linked list
Lovely Professional University
 
Linked List Representation of a Linked List.pptx
Linked List Representation of a Linked List.pptx
AAUsH2
 
data structures and applications power p
data structures and applications power p
MeghaKulkarni27
 
Ppt on Linked list,stack,queue
Ppt on Linked list,stack,queue
Srajan Shukla
 
Data Structures 3
Data Structures 3
Dr.Umadevi V
 
single linked list
single linked list
Sathasivam Rangasamy
 
10994103.ppt
10994103.ppt
SushmaG48
 
header, circular and two way linked lists
header, circular and two way linked lists
student
 
linked list1.ppt linked list ppts and notes
linked list1.ppt linked list ppts and notes
nisharaheja1986
 
ds-lecture-4-171012041008 (1).pdf
ds-lecture-4-171012041008 (1).pdf
KamranAli649587
 
DS Module 03.pdf
DS Module 03.pdf
SonaPathak5
 
RPT_03_A_Linked List presentation for FE
RPT_03_A_Linked List presentation for FE
AshishFamt
 
linked list in data structure
linked list in data structure
shameen khan
 
Stacks and Queues with Linked List.pdf
Stacks and Queues with Linked List.pdf
GKalyani4
 
DS10-QUEUE0000000000000000000000000000000000000.pptx
DS10-QUEUE0000000000000000000000000000000000000.pptx
ProfVMGawde
 
Linked List Representation of a Linked List.pptx
Linked List Representation of a Linked List.pptx
AAUsH2
 
data structures and applications power p
data structures and applications power p
MeghaKulkarni27
 
Ppt on Linked list,stack,queue
Ppt on Linked list,stack,queue
Srajan Shukla
 
10994103.ppt
10994103.ppt
SushmaG48
 
header, circular and two way linked lists
header, circular and two way linked lists
student
 
linked list1.ppt linked list ppts and notes
linked list1.ppt linked list ppts and notes
nisharaheja1986
 
Ad

Recently uploaded (20)

Tally.ERP 9 at a Glance.book - Tally Solutions .pdf
Tally.ERP 9 at a Glance.book - Tally Solutions .pdf
Shabista Imam
 
Introduction to sensing and Week-1.pptx
Introduction to sensing and Week-1.pptx
KNaveenKumarECE
 
362 Alec Data Center Solutions-Slysium Data Center-AUH-Adaptaflex.pdf
362 Alec Data Center Solutions-Slysium Data Center-AUH-Adaptaflex.pdf
djiceramil
 
FUNDAMENTALS OF COMPUTER ORGANIZATION AND ARCHITECTURE
FUNDAMENTALS OF COMPUTER ORGANIZATION AND ARCHITECTURE
Shabista Imam
 
machine learning is a advance technology
machine learning is a advance technology
ynancy893
 
DESIGN OF REINFORCED CONCRETE ELEMENTS S
DESIGN OF REINFORCED CONCRETE ELEMENTS S
prabhusp8
 
Tesla-Stock-Analysis-and-Forecast.pptx (1).pptx
Tesla-Stock-Analysis-and-Forecast.pptx (1).pptx
moonsony54
 
ElysiumPro Company Profile 2025-2026.pdf
ElysiumPro Company Profile 2025-2026.pdf
info751436
 
IntroSlides-June-GDG-Cloud-Munich community [email protected]
IntroSlides-June-GDG-Cloud-Munich community [email protected]
Luiz Carneiro
 
IPL_Logic_Flow.pdf Mainframe IPLMainframe IPL
IPL_Logic_Flow.pdf Mainframe IPLMainframe IPL
KhadijaKhadijaAouadi
 
60 Years and Beyond eBook 1234567891.pdf
60 Years and Beyond eBook 1234567891.pdf
waseemalazzeh
 
Abraham Silberschatz-Operating System Concepts (9th,2012.12).pdf
Abraham Silberschatz-Operating System Concepts (9th,2012.12).pdf
Shabista Imam
 
Solar thermal – Flat plate and concentrating collectors .pptx
Solar thermal – Flat plate and concentrating collectors .pptx
jdaniabraham1
 
Cadastral Maps
Cadastral Maps
Google
 
362 Alec Data Center Solutions-Slysium Data Center-AUH-Adaptaflex.pdf
362 Alec Data Center Solutions-Slysium Data Center-AUH-Adaptaflex.pdf
djiceramil
 
Fundamentals of Digital Design_Class_21st May - Copy.pptx
Fundamentals of Digital Design_Class_21st May - Copy.pptx
drdebarshi1993
 
International Journal of Advanced Information Technology (IJAIT)
International Journal of Advanced Information Technology (IJAIT)
ijait
 
nnnnnnnnnnnn7777777777777777777777777777777.pptx
nnnnnnnnnnnn7777777777777777777777777777777.pptx
gayathri venkataramani
 
David Boutry - Mentors Junior Developers
David Boutry - Mentors Junior Developers
David Boutry
 
Structured Programming with C++ :: Kjell Backman
Structured Programming with C++ :: Kjell Backman
Shabista Imam
 
Tally.ERP 9 at a Glance.book - Tally Solutions .pdf
Tally.ERP 9 at a Glance.book - Tally Solutions .pdf
Shabista Imam
 
Introduction to sensing and Week-1.pptx
Introduction to sensing and Week-1.pptx
KNaveenKumarECE
 
362 Alec Data Center Solutions-Slysium Data Center-AUH-Adaptaflex.pdf
362 Alec Data Center Solutions-Slysium Data Center-AUH-Adaptaflex.pdf
djiceramil
 
FUNDAMENTALS OF COMPUTER ORGANIZATION AND ARCHITECTURE
FUNDAMENTALS OF COMPUTER ORGANIZATION AND ARCHITECTURE
Shabista Imam
 
machine learning is a advance technology
machine learning is a advance technology
ynancy893
 
DESIGN OF REINFORCED CONCRETE ELEMENTS S
DESIGN OF REINFORCED CONCRETE ELEMENTS S
prabhusp8
 
Tesla-Stock-Analysis-and-Forecast.pptx (1).pptx
Tesla-Stock-Analysis-and-Forecast.pptx (1).pptx
moonsony54
 
ElysiumPro Company Profile 2025-2026.pdf
ElysiumPro Company Profile 2025-2026.pdf
info751436
 
IPL_Logic_Flow.pdf Mainframe IPLMainframe IPL
IPL_Logic_Flow.pdf Mainframe IPLMainframe IPL
KhadijaKhadijaAouadi
 
60 Years and Beyond eBook 1234567891.pdf
60 Years and Beyond eBook 1234567891.pdf
waseemalazzeh
 
Abraham Silberschatz-Operating System Concepts (9th,2012.12).pdf
Abraham Silberschatz-Operating System Concepts (9th,2012.12).pdf
Shabista Imam
 
Solar thermal – Flat plate and concentrating collectors .pptx
Solar thermal – Flat plate and concentrating collectors .pptx
jdaniabraham1
 
Cadastral Maps
Cadastral Maps
Google
 
362 Alec Data Center Solutions-Slysium Data Center-AUH-Adaptaflex.pdf
362 Alec Data Center Solutions-Slysium Data Center-AUH-Adaptaflex.pdf
djiceramil
 
Fundamentals of Digital Design_Class_21st May - Copy.pptx
Fundamentals of Digital Design_Class_21st May - Copy.pptx
drdebarshi1993
 
International Journal of Advanced Information Technology (IJAIT)
International Journal of Advanced Information Technology (IJAIT)
ijait
 
nnnnnnnnnnnn7777777777777777777777777777777.pptx
nnnnnnnnnnnn7777777777777777777777777777777.pptx
gayathri venkataramani
 
David Boutry - Mentors Junior Developers
David Boutry - Mentors Junior Developers
David Boutry
 
Structured Programming with C++ :: Kjell Backman
Structured Programming with C++ :: Kjell Backman
Shabista Imam
 
Ad

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