SlideShare a Scribd company logo
QUEUE USING LINKED LIST
ALGORITHM FOR PUSHING AN ELEMENT TO A QUEUE
1. Input the VALUE element to be pushed
2. Create a New Node
3. NewNode -> DATA = VALUE
4. NewNode -> Next = NULL
// if it is not empty
5. If(REAR not equal to NULL)
(a) REAR -> next = NewNode
(b) REAR = NewNode
6. Else
REAR = FRONT = NewNode
7. Exit
36
QUEUE USING LINKED LIST
ALGORITHM FOR POPPING ELEMENT FROM A QUEUE
1. If (FRONT is equal to NULL)
Display "The Queue is
empty"
2. Else
(a) print FRONT -> DATA
(b) TEMP = FRONT
(c) FRONT = FRONT -> Next
(d) If(FRONT is equal to NULL)
REAR = NULL
(e) Free the TEMP node
3. Exit
37
DOUBLY LINKED LIST
Every nodes in the doubly linked list has three fields:
LeftPointer, RightPointer and DATA.
38
REPRESENTATION OF DOUBLY LINKED LIST
•A node in the doubly linked list can be represented
with the following declarations:
struct Node
{
int DATA;
Node * next;
Node * prev;
};
Node *
START;
•All operations performed on singly linked list can also
be performed on doubly linked list. 39

More Related Content

Similar to ALGORITHM FOR PUSHING AN ELEMENT TO A QUEUE (20)

PPT
03-Lists.ppt
huynguyen556776
 
PPTX
Doubly linked list (animated)
DivyeshKumar Jagatiya
 
PDF
Data structures arrays
maamir farooq
 
PPTX
linkedlistforslideshare-210123143943.pptx
shesnasuneer
 
PPTX
Linked list
KalaivaniKS1
 
PPTX
Linked list
Arbind Mandal
 
PPTX
Unit 5 linked list
Dabbal Singh Mahara
 
PPT
Operations on linked list
Sumathi Kv
 
PDF
Sorted number list implementation with linked listsStep 1 Inspec.pdf
almaniaeyewear
 
PDF
Write a JAVA LinkedListRec class that has the following methods siz.pdf
info785431
 
PPTX
Stack.pptx
AliRaza899305
 
PPTX
Dounly linked list
NirmalPandey23
 
PPT
Abstract data types
JAGDEEPKUMAR23
 
PPSX
Data Structure (Dynamic Array and Linked List)
Adam Mukharil Bachtiar
 
PPTX
Lecture 4_Linear & Binary search from data structure and algorithm
ArifatunNesa
 
PDF
Unit - 2.pdf
AravindAnand21
 
PDF
Please help solve this in C++ So the program is working fin.pdf
ankit11134
 
PPT
linked-list.ppt
DikkySuryadiSKomMKom
 
03-Lists.ppt
huynguyen556776
 
Doubly linked list (animated)
DivyeshKumar Jagatiya
 
Data structures arrays
maamir farooq
 
linkedlistforslideshare-210123143943.pptx
shesnasuneer
 
Linked list
KalaivaniKS1
 
Linked list
Arbind Mandal
 
Unit 5 linked list
Dabbal Singh Mahara
 
Operations on linked list
Sumathi Kv
 
Sorted number list implementation with linked listsStep 1 Inspec.pdf
almaniaeyewear
 
Write a JAVA LinkedListRec class that has the following methods siz.pdf
info785431
 
Stack.pptx
AliRaza899305
 
Dounly linked list
NirmalPandey23
 
Abstract data types
JAGDEEPKUMAR23
 
Data Structure (Dynamic Array and Linked List)
Adam Mukharil Bachtiar
 
Lecture 4_Linear & Binary search from data structure and algorithm
ArifatunNesa
 
Unit - 2.pdf
AravindAnand21
 
Please help solve this in C++ So the program is working fin.pdf
ankit11134
 
linked-list.ppt
DikkySuryadiSKomMKom
 

More from Anil Yadav (20)

PPTX
Link List : Introduction to List and Linked Lists
Anil Yadav
 
PPTX
Link List REPRESENTATION OF DOUBLY LINKED LIST
Anil Yadav
 
PPTX
Link List STACK and Queue USING LINKED LIST
Anil Yadav
 
PPTX
Link List Programming Linked List in Cpp
Anil Yadav
 
PPTX
Link List & ALGORITHM FOR DELETING A NODE
Anil Yadav
 
PPTX
Link List ALGORITHM FOR INSERTING A NODE
Anil Yadav
 
PPTX
Presentations Linked Lists Data Structure
Anil Yadav
 
PPT
Lec-12, 13 Quees First In First Out (FIFO)
Anil Yadav
 
PPT
Lec-12, 13 Quee s Applications of Queues
Anil Yadav
 
PPT
Lec-12, 13 Quees Array Implementation IN
Anil Yadav
 
PPT
Lec-12, 13 Quees In Queue IntQueue(int s)
Anil Yadav
 
PPT
Lec-12, 13 Quees A class for Dynamic Queue implementation
Anil Yadav
 
PPT
Function enqueue inserts the value in num
Anil Yadav
 
PPT
Lec-12, 13 Quees -How to determine empty and full Queues?
Anil Yadav
 
PDF
Unit2-BIS Business Information system Data
Anil Yadav
 
PPT
Lec-12, 13 Queues - IntQueue IntQueue(int s) //constructor
Anil Yadav
 
PPT
Lec-12, 13 Quees Another implementation of Queues using Arrays
Anil Yadav
 
PPT
Lec-12, 13 Quees - Circular Queues and Implementation with Array
Anil Yadav
 
PPT
Lec-32 Recursion - Divide and Conquer in Queue
Anil Yadav
 
PPT
Lec-32 Recursion -Recursion in Computer Science
Anil Yadav
 
Link List : Introduction to List and Linked Lists
Anil Yadav
 
Link List REPRESENTATION OF DOUBLY LINKED LIST
Anil Yadav
 
Link List STACK and Queue USING LINKED LIST
Anil Yadav
 
Link List Programming Linked List in Cpp
Anil Yadav
 
Link List & ALGORITHM FOR DELETING A NODE
Anil Yadav
 
Link List ALGORITHM FOR INSERTING A NODE
Anil Yadav
 
Presentations Linked Lists Data Structure
Anil Yadav
 
Lec-12, 13 Quees First In First Out (FIFO)
Anil Yadav
 
Lec-12, 13 Quee s Applications of Queues
Anil Yadav
 
Lec-12, 13 Quees Array Implementation IN
Anil Yadav
 
Lec-12, 13 Quees In Queue IntQueue(int s)
Anil Yadav
 
Lec-12, 13 Quees A class for Dynamic Queue implementation
Anil Yadav
 
Function enqueue inserts the value in num
Anil Yadav
 
Lec-12, 13 Quees -How to determine empty and full Queues?
Anil Yadav
 
Unit2-BIS Business Information system Data
Anil Yadav
 
Lec-12, 13 Queues - IntQueue IntQueue(int s) //constructor
Anil Yadav
 
Lec-12, 13 Quees Another implementation of Queues using Arrays
Anil Yadav
 
Lec-12, 13 Quees - Circular Queues and Implementation with Array
Anil Yadav
 
Lec-32 Recursion - Divide and Conquer in Queue
Anil Yadav
 
Lec-32 Recursion -Recursion in Computer Science
Anil Yadav
 
Ad

Recently uploaded (20)

PPTX
I AM MALALA The Girl Who Stood Up for Education and was Shot by the Taliban...
Beena E S
 
PPTX
PATIENT ASSIGNMENTS AND NURSING CARE RESPONSIBILITIES.pptx
PRADEEP ABOTHU
 
PDF
Geographical diversity of India short notes by sandeep swamy
Sandeep Swamy
 
PPTX
Neurodivergent Friendly Schools - Slides from training session
Pooky Knightsmith
 
PPTX
PPT-Q1-WK-3-ENGLISH Revised Matatag Grade 3.pptx
reijhongidayawan02
 
PDF
Stokey: A Jewish Village by Rachel Kolsky
History of Stoke Newington
 
PPTX
Cultivation practice of Litchi in Nepal.pptx
UmeshTimilsina1
 
PPTX
How to Create Odoo JS Dialog_Popup in Odoo 18
Celine George
 
PPTX
care of patient with elimination needs.pptx
Rekhanjali Gupta
 
PDF
Chapter-V-DED-Entrepreneurship: Institutions Facilitating Entrepreneurship
Dayanand Huded
 
PDF
Aprendendo Arquitetura Framework Salesforce - Dia 03
Mauricio Alexandre Silva
 
PPTX
How to Convert an Opportunity into a Quotation in Odoo 18 CRM
Celine George
 
PPTX
Post Dated Cheque(PDC) Management in Odoo 18
Celine George
 
PPTX
STAFF DEVELOPMENT AND WELFARE: MANAGEMENT
PRADEEP ABOTHU
 
PPTX
Stereochemistry-Optical Isomerism in organic compoundsptx
Tarannum Nadaf-Mansuri
 
PDF
Dimensions of Societal Planning in Commonism
StefanMz
 
PPTX
grade 5 lesson matatag ENGLISH 5_Q1_PPT_WEEK4.pptx
SireQuinn
 
PDF
Isharyanti-2025-Cross Language Communication in Indonesian Language
Neny Isharyanti
 
PDF
Geographical Diversity of India 100 Mcq.pdf/ 7th class new ncert /Social/Samy...
Sandeep Swamy
 
PDF
The Different Types of Non-Experimental Research
Thelma Villaflores
 
I AM MALALA The Girl Who Stood Up for Education and was Shot by the Taliban...
Beena E S
 
PATIENT ASSIGNMENTS AND NURSING CARE RESPONSIBILITIES.pptx
PRADEEP ABOTHU
 
Geographical diversity of India short notes by sandeep swamy
Sandeep Swamy
 
Neurodivergent Friendly Schools - Slides from training session
Pooky Knightsmith
 
PPT-Q1-WK-3-ENGLISH Revised Matatag Grade 3.pptx
reijhongidayawan02
 
Stokey: A Jewish Village by Rachel Kolsky
History of Stoke Newington
 
Cultivation practice of Litchi in Nepal.pptx
UmeshTimilsina1
 
How to Create Odoo JS Dialog_Popup in Odoo 18
Celine George
 
care of patient with elimination needs.pptx
Rekhanjali Gupta
 
Chapter-V-DED-Entrepreneurship: Institutions Facilitating Entrepreneurship
Dayanand Huded
 
Aprendendo Arquitetura Framework Salesforce - Dia 03
Mauricio Alexandre Silva
 
How to Convert an Opportunity into a Quotation in Odoo 18 CRM
Celine George
 
Post Dated Cheque(PDC) Management in Odoo 18
Celine George
 
STAFF DEVELOPMENT AND WELFARE: MANAGEMENT
PRADEEP ABOTHU
 
Stereochemistry-Optical Isomerism in organic compoundsptx
Tarannum Nadaf-Mansuri
 
Dimensions of Societal Planning in Commonism
StefanMz
 
grade 5 lesson matatag ENGLISH 5_Q1_PPT_WEEK4.pptx
SireQuinn
 
Isharyanti-2025-Cross Language Communication in Indonesian Language
Neny Isharyanti
 
Geographical Diversity of India 100 Mcq.pdf/ 7th class new ncert /Social/Samy...
Sandeep Swamy
 
The Different Types of Non-Experimental Research
Thelma Villaflores
 
Ad

ALGORITHM FOR PUSHING AN ELEMENT TO A QUEUE

  • 1. QUEUE USING LINKED LIST ALGORITHM FOR PUSHING AN ELEMENT TO A QUEUE 1. Input the VALUE element to be pushed 2. Create a New Node 3. NewNode -> DATA = VALUE 4. NewNode -> Next = NULL // if it is not empty 5. If(REAR not equal to NULL) (a) REAR -> next = NewNode (b) REAR = NewNode 6. Else REAR = FRONT = NewNode 7. Exit 36
  • 2. QUEUE USING LINKED LIST ALGORITHM FOR POPPING ELEMENT FROM A QUEUE 1. If (FRONT is equal to NULL) Display "The Queue is empty" 2. Else (a) print FRONT -> DATA (b) TEMP = FRONT (c) FRONT = FRONT -> Next (d) If(FRONT is equal to NULL) REAR = NULL (e) Free the TEMP node 3. Exit 37
  • 3. DOUBLY LINKED LIST Every nodes in the doubly linked list has three fields: LeftPointer, RightPointer and DATA. 38
  • 4. REPRESENTATION OF DOUBLY LINKED LIST •A node in the doubly linked list can be represented with the following declarations: struct Node { int DATA; Node * next; Node * prev; }; Node * START; •All operations performed on singly linked list can also be performed on doubly linked list. 39