SlideShare a Scribd company logo
2
Most read
3
Most read
4
Most read
Presented BY : Shraddha Malviya
“Stack and Queue using Linked List”
Roll No. : MCA/25018/18
Stack
A stack is an ordered list with the restriction that element are
added or deleted from only one end of list termed top of stack. The
other end of the list which lies ‘inactive’ is termed bottom of stack.
Stack using linked list
A linked stack is a linear list of elements commonly
implemented as a singly linked list whose start
pointer perform the role of the top pointer of stack .
c b a
top
Linked representation of stack
Stack operation :
Push operation-
c a
top
b
Linked stack S
Push ‘d’ into S
cd ab
top
top
Push operation
PUSH_LINKSTACK(TOP,ITEM)
Call GETNODE(X)
DATA(X) = ITEM /*frame node item */
LINK(X) = TOP /* insert into x into stack */
TOP = X /*reset Top pointer */
end PUSH_LINKSTACK.
Pop operation-
c ab
Linked stack Stop
Pop ‘c’ from S
c ab
top
top
Push operation
POP_LINKSTACK(TOP,ITEM)
if(TOP=0)
then call LINKSTACK_EMPTY
else
{
TEMP=TOP;
ITEM=DATA(TOP);
TOP=LINK(TOP);
}
Call RETURN (TEMP)
end POP_LINKSTACK
Queue
A Queue is a linear list in which all insertion are
made at one end of the list known as rear or tail of
queue and all deletion are made at the other end
known as front or head of the queue . An insertion
operation is also referred to as enqueuing a queue
and deletion operation is referred to as dequeuing a
queue.
Queue using linked list
A linked queue is also linear list of element
commonly implemented as a singly linked list but
with two pointer ,Front and Rear . The start pointer
of the singly linked list plays the role of Front while
the pointer to the last node is set to play the role
of Rear .
a b c
front
rear
Linked representation of queue
Queue operation :
Insert operation--
a b
front
c
rear
Insert ‘d into queue’
a b dc
rear
front
rear
Insertion operation
INSERT_LINKQUEUE(FRONT,REAR,
ITEM)
Call GETNODE (X);
DATA (X) = ITEM;
LINK (X) = NIL;
if(FRONT = 0)
then FRONT = REAR = X;
else
{
LINK (REAR) = X;
REAR = X;
}
end INSERT_LINKQUEUE
Delete operation--
a b c
rear
front
Delete ‘a’ from queue
front
a b c
rear
front
Delete operation
DELETE_LINKQUEUE (FRONT , ITEM)
if(FRONT = 0)
then call LINKQUEUE_EMPTY;
else
{
TEMP = FRONT;
ITEM= DATA(TEMP);
FRONT = LINK(TEMP);
}
call RETURN (TEMP);
end DELETE_LINKQUEUE
Application
 Balancing symbol
Reference:
DATA STRUCTURES AND ALGORITHMS, GAV
Book:
THANKYOU

More Related Content

PPTX
Stack and queue
CHANDAN KUMAR
 
PPTX
Computer Science-Data Structures :Abstract DataType (ADT)
St Mary's College,Thrissur,Kerala
 
PPTX
Unit I-Data structures stack & Queue
DrkhanchanaR
 
PPTX
Stack - Data Structure - Notes
Omprakash Chauhan
 
PPT
Binary tree
Rajendran
 
PPTX
Queue and its operations
V.V.Vanniaperumal College for Women
 
PPT
1.5 binary search tree
Krish_ver2
 
PDF
UNIT II LINEAR DATA STRUCTURES – STACKS, QUEUES
Kathirvel Ayyaswamy
 
Stack and queue
CHANDAN KUMAR
 
Computer Science-Data Structures :Abstract DataType (ADT)
St Mary's College,Thrissur,Kerala
 
Unit I-Data structures stack & Queue
DrkhanchanaR
 
Stack - Data Structure - Notes
Omprakash Chauhan
 
Binary tree
Rajendran
 
Queue and its operations
V.V.Vanniaperumal College for Women
 
1.5 binary search tree
Krish_ver2
 
UNIT II LINEAR DATA STRUCTURES – STACKS, QUEUES
Kathirvel Ayyaswamy
 

What's hot (20)

PPT
stack presentation
Shivalik college of engineering
 
PPTX
Data Structures - Lecture 9 [Stack & Queue using Linked List]
Muhammad Hammad Waseem
 
PPTX
sorting and its types
SIVASHANKARIRAJAN
 
PPTX
single linked list
Sathasivam Rangasamy
 
PDF
Stack
Zaid Shabbir
 
PPT
Binary search tree in data structures
chauhankapil
 
PDF
03 Linear Arrays Memory Representations .pdf
KkSingh64
 
PPTX
Binary Heap Tree, Data Structure
Anand Ingle
 
PPT
Searching algorithms
Trupti Agrawal
 
PPTX
Circular queue
Lovely Professional University
 
PPTX
Array operations
ZAFAR444
 
PPTX
Priority queue in DSA
junnubabu
 
PPTX
Application of Stack For Expression Evaluation by Prakash Zodge DSY 41.pptx
Prakash Zodge
 
PDF
Applications of stack
eShikshak
 
PPT
Data Structures- Part5 recursion
Abdullah Al-hazmy
 
PPTX
Insertion Sorting
FarihaHabib123
 
PPTX
Stack using Linked List
Sayantan Sur
 
PPTX
Recursion in Data Structure
khudabux1998
 
PPSX
Stack
Seema Sharma
 
PPTX
Huffman's algorithm in Data Structure
Vrushali Dhanokar
 
Data Structures - Lecture 9 [Stack & Queue using Linked List]
Muhammad Hammad Waseem
 
sorting and its types
SIVASHANKARIRAJAN
 
single linked list
Sathasivam Rangasamy
 
Binary search tree in data structures
chauhankapil
 
03 Linear Arrays Memory Representations .pdf
KkSingh64
 
Binary Heap Tree, Data Structure
Anand Ingle
 
Searching algorithms
Trupti Agrawal
 
Array operations
ZAFAR444
 
Priority queue in DSA
junnubabu
 
Application of Stack For Expression Evaluation by Prakash Zodge DSY 41.pptx
Prakash Zodge
 
Applications of stack
eShikshak
 
Data Structures- Part5 recursion
Abdullah Al-hazmy
 
Insertion Sorting
FarihaHabib123
 
Stack using Linked List
Sayantan Sur
 
Recursion in Data Structure
khudabux1998
 
Huffman's algorithm in Data Structure
Vrushali Dhanokar
 
Ad

Similar to Stack & Queue using Linked List in Data Structure (20)

PDF
Linked stack-and-linked-queue
soniasharmafdp
 
PPTX
stacks and queues
EktaVaswani2
 
PPTX
VCE Unit 03vv.pptx
skilljiolms
 
PPSX
Data Structure (Queue)
Adam Mukharil Bachtiar
 
PDF
chapter10-queue-161018120329.pdf
ssuserff72e4
 
PPTX
STACK, LINKED LIST ,AND QUEUE
Dev Chauhan
 
PPTX
Stack & Queue
Hasan Mahadi Riaz
 
PDF
9f556226-babd-4276-b964-371c6a5a77b9.pdf
kumarharsh2119hk
 
PPTX
queue.pptx
NSudhaEccs
 
PPT
Lec-07 Queues.ppt queues introduction to queue
AmsaAzeem
 
PPT
unit 5 stack & queue.ppt
SeethaDinesh
 
PPTX
6.queue
Chandan Singh
 
DOCX
CDS artificial intelligence and Machine.docx
msurfudeen6681
 
PDF
Queue
pooja kumari
 
PPTX
queue
umair khan
 
PPTX
Lecture 7 data structures and algorithms
Aakash deep Singhal
 
PPT
Rana Junaid Rasheed
Rana junaid Rasheed
 
PPT
Stacks queues-1220971554378778-9
Getachew Ganfur
 
PPTX
introduction of the Stacks and Queues.pptx
kavitashingi123
 
PPTX
Bsc cs ii dfs u-2 linklist,stack,queue
Rai University
 
Linked stack-and-linked-queue
soniasharmafdp
 
stacks and queues
EktaVaswani2
 
VCE Unit 03vv.pptx
skilljiolms
 
Data Structure (Queue)
Adam Mukharil Bachtiar
 
chapter10-queue-161018120329.pdf
ssuserff72e4
 
STACK, LINKED LIST ,AND QUEUE
Dev Chauhan
 
Stack & Queue
Hasan Mahadi Riaz
 
9f556226-babd-4276-b964-371c6a5a77b9.pdf
kumarharsh2119hk
 
queue.pptx
NSudhaEccs
 
Lec-07 Queues.ppt queues introduction to queue
AmsaAzeem
 
unit 5 stack & queue.ppt
SeethaDinesh
 
6.queue
Chandan Singh
 
CDS artificial intelligence and Machine.docx
msurfudeen6681
 
queue
umair khan
 
Lecture 7 data structures and algorithms
Aakash deep Singhal
 
Rana Junaid Rasheed
Rana junaid Rasheed
 
Stacks queues-1220971554378778-9
Getachew Ganfur
 
introduction of the Stacks and Queues.pptx
kavitashingi123
 
Bsc cs ii dfs u-2 linklist,stack,queue
Rai University
 
Ad

More from Meghaj Mallick (20)

PPT
24 partial-orderings
Meghaj Mallick
 
PPTX
PORTFOLIO BY USING HTML & CSS
Meghaj Mallick
 
PPTX
Introduction to Software Testing
Meghaj Mallick
 
PPTX
Introduction to System Programming
Meghaj Mallick
 
PPTX
MACRO ASSEBLER
Meghaj Mallick
 
PPTX
Icons, Image & Multimedia
Meghaj Mallick
 
PPTX
Project Tracking & SPC
Meghaj Mallick
 
PPTX
Peephole Optimization
Meghaj Mallick
 
PPTX
Routing in MANET
Meghaj Mallick
 
PPTX
Macro assembler
Meghaj Mallick
 
PPTX
Architecture and security in Vanet PPT
Meghaj Mallick
 
PPTX
Design Model & User Interface Design in Software Engineering
Meghaj Mallick
 
PPTX
Text Mining of Twitter in Data Mining
Meghaj Mallick
 
PPTX
DFS & BFS in Computer Algorithm
Meghaj Mallick
 
PPTX
Software Development Method
Meghaj Mallick
 
PPTX
Secant method in Numerical & Statistical Method
Meghaj Mallick
 
PPTX
Motivation in Organization
Meghaj Mallick
 
PPTX
Communication Skill
Meghaj Mallick
 
PPT
Partial-Orderings in Discrete Mathematics
Meghaj Mallick
 
PPTX
Hashing In Data Structure
Meghaj Mallick
 
24 partial-orderings
Meghaj Mallick
 
PORTFOLIO BY USING HTML & CSS
Meghaj Mallick
 
Introduction to Software Testing
Meghaj Mallick
 
Introduction to System Programming
Meghaj Mallick
 
MACRO ASSEBLER
Meghaj Mallick
 
Icons, Image & Multimedia
Meghaj Mallick
 
Project Tracking & SPC
Meghaj Mallick
 
Peephole Optimization
Meghaj Mallick
 
Routing in MANET
Meghaj Mallick
 
Macro assembler
Meghaj Mallick
 
Architecture and security in Vanet PPT
Meghaj Mallick
 
Design Model & User Interface Design in Software Engineering
Meghaj Mallick
 
Text Mining of Twitter in Data Mining
Meghaj Mallick
 
DFS & BFS in Computer Algorithm
Meghaj Mallick
 
Software Development Method
Meghaj Mallick
 
Secant method in Numerical & Statistical Method
Meghaj Mallick
 
Motivation in Organization
Meghaj Mallick
 
Communication Skill
Meghaj Mallick
 
Partial-Orderings in Discrete Mathematics
Meghaj Mallick
 
Hashing In Data Structure
Meghaj Mallick
 

Recently uploaded (20)

PPTX
Information Security and Risk Management.pptx
prembasnet12
 
PDF
Media Training for Authors: Producing Videos & Nailing Interviews
Paula Rizzo
 
PPTX
PHILIPPINE LITERATURE DURING SPANISH ERA
AllizaJoyMendigoria
 
PPTX
Postmodernism notes for literature students
POORNIMAN26
 
DOCX
Ss Peter & Paul Choir Formation Training
kiambutownshipsecond
 
PPTX
Presentation of Project of Enterprenuership topic- "Green Gaurdian"
vinay patel
 
PPTX
2025-08-03 Joseph 01 (shared slides).pptx
Dale Wells
 
PPTX
Understanding-Communication-Berlos-S-M-C-R-Model.pptx
JommelVienne
 
DOCX
Policies & Procedures of Internal Audit Department of Shelter Holding LLC.docx
AlamGir100
 
PPTX
What is Clause, definition and structure
DidinDaengLiong
 
PDF
protein structure and function for basics .pdf
RakeshKumar508211
 
PPTX
IBA DISTRICT PIR PRESENTATION.POWERPOINT
ROGELIOLADIERO1
 
PPTX
Caption Text about Social Media Post in Internet
DidinDaengLiong
 
PPTX
Cohort Study_PPT.group presentation_pdf.pptx
fatemakhan242
 
PPTX
Bob Stewart Journey to Rome 07 30 2025.pptx
FamilyWorshipCenterD
 
PPTX
Assam' Vibrant Bihu Festival Bihu presentation.pptx
rpmsbarman
 
PDF
Enhancing Bambara Groundnut Production Through Improved Agronomic Practices
Francois Stepman
 
PPTX
Selecting relevant value chain/s for Impactful Development Policies
Francois Stepman
 
PPTX
CASE PRESENTATION prev 1 lscs[1].pptxgyjgg
PriyalSharma25
 
PPTX
business communication final draftt.pptx
jiyasharma1701
 
Information Security and Risk Management.pptx
prembasnet12
 
Media Training for Authors: Producing Videos & Nailing Interviews
Paula Rizzo
 
PHILIPPINE LITERATURE DURING SPANISH ERA
AllizaJoyMendigoria
 
Postmodernism notes for literature students
POORNIMAN26
 
Ss Peter & Paul Choir Formation Training
kiambutownshipsecond
 
Presentation of Project of Enterprenuership topic- "Green Gaurdian"
vinay patel
 
2025-08-03 Joseph 01 (shared slides).pptx
Dale Wells
 
Understanding-Communication-Berlos-S-M-C-R-Model.pptx
JommelVienne
 
Policies & Procedures of Internal Audit Department of Shelter Holding LLC.docx
AlamGir100
 
What is Clause, definition and structure
DidinDaengLiong
 
protein structure and function for basics .pdf
RakeshKumar508211
 
IBA DISTRICT PIR PRESENTATION.POWERPOINT
ROGELIOLADIERO1
 
Caption Text about Social Media Post in Internet
DidinDaengLiong
 
Cohort Study_PPT.group presentation_pdf.pptx
fatemakhan242
 
Bob Stewart Journey to Rome 07 30 2025.pptx
FamilyWorshipCenterD
 
Assam' Vibrant Bihu Festival Bihu presentation.pptx
rpmsbarman
 
Enhancing Bambara Groundnut Production Through Improved Agronomic Practices
Francois Stepman
 
Selecting relevant value chain/s for Impactful Development Policies
Francois Stepman
 
CASE PRESENTATION prev 1 lscs[1].pptxgyjgg
PriyalSharma25
 
business communication final draftt.pptx
jiyasharma1701
 

Stack & Queue using Linked List in Data Structure

  • 1. Presented BY : Shraddha Malviya “Stack and Queue using Linked List” Roll No. : MCA/25018/18
  • 2. Stack A stack is an ordered list with the restriction that element are added or deleted from only one end of list termed top of stack. The other end of the list which lies ‘inactive’ is termed bottom of stack.
  • 3. Stack using linked list A linked stack is a linear list of elements commonly implemented as a singly linked list whose start pointer perform the role of the top pointer of stack . c b a top Linked representation of stack
  • 4. Stack operation : Push operation- c a top b Linked stack S Push ‘d’ into S cd ab top top Push operation PUSH_LINKSTACK(TOP,ITEM) Call GETNODE(X) DATA(X) = ITEM /*frame node item */ LINK(X) = TOP /* insert into x into stack */ TOP = X /*reset Top pointer */ end PUSH_LINKSTACK.
  • 5. Pop operation- c ab Linked stack Stop Pop ‘c’ from S c ab top top Push operation POP_LINKSTACK(TOP,ITEM) if(TOP=0) then call LINKSTACK_EMPTY else { TEMP=TOP; ITEM=DATA(TOP); TOP=LINK(TOP); } Call RETURN (TEMP) end POP_LINKSTACK
  • 6. Queue A Queue is a linear list in which all insertion are made at one end of the list known as rear or tail of queue and all deletion are made at the other end known as front or head of the queue . An insertion operation is also referred to as enqueuing a queue and deletion operation is referred to as dequeuing a queue.
  • 7. Queue using linked list A linked queue is also linear list of element commonly implemented as a singly linked list but with two pointer ,Front and Rear . The start pointer of the singly linked list plays the role of Front while the pointer to the last node is set to play the role of Rear . a b c front rear Linked representation of queue
  • 8. Queue operation : Insert operation-- a b front c rear Insert ‘d into queue’ a b dc rear front rear Insertion operation INSERT_LINKQUEUE(FRONT,REAR, ITEM) Call GETNODE (X); DATA (X) = ITEM; LINK (X) = NIL; if(FRONT = 0) then FRONT = REAR = X; else { LINK (REAR) = X; REAR = X; } end INSERT_LINKQUEUE
  • 9. Delete operation-- a b c rear front Delete ‘a’ from queue front a b c rear front Delete operation DELETE_LINKQUEUE (FRONT , ITEM) if(FRONT = 0) then call LINKQUEUE_EMPTY; else { TEMP = FRONT; ITEM= DATA(TEMP); FRONT = LINK(TEMP); } call RETURN (TEMP); end DELETE_LINKQUEUE
  • 11. Reference: DATA STRUCTURES AND ALGORITHMS, GAV Book: