SlideShare a Scribd company logo
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.
Most read
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
Most read
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.
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

What's hot (20)

Trees, Binary Search Tree, AVL Tree in Data Structures
Trees, Binary Search Tree, AVL Tree in Data Structures Trees, Binary Search Tree, AVL Tree in Data Structures
Trees, Binary Search Tree, AVL Tree in Data Structures
Gurukul Kangri Vishwavidyalaya - Faculty of Engineering and Technology
 
Analysis of algorithm
Analysis of algorithmAnalysis of algorithm
Analysis of algorithm
Rajendra Dangwal
 
Stack Data Structure & It's Application
Stack Data Structure & It's Application Stack Data Structure & It's Application
Stack Data Structure & It's Application
Tech_MX
 
Selection sort
Selection sortSelection sort
Selection sort
stella D
 
Stacks IN DATA STRUCTURES
Stacks IN DATA STRUCTURESStacks IN DATA STRUCTURES
Stacks IN DATA STRUCTURES
Sowmya Jyothi
 
Stack and its Applications : Data Structures ADT
Stack and its Applications : Data Structures ADTStack and its Applications : Data Structures ADT
Stack and its Applications : Data Structures ADT
Soumen Santra
 
Binary search tree in data structures
Binary search tree in  data structuresBinary search tree in  data structures
Binary search tree in data structures
chauhankapil
 
Merge Sort
Merge SortMerge Sort
Merge Sort
Nikhil Sonkamble
 
Doubly Linked List || Operations || Algorithms
Doubly Linked List || Operations || AlgorithmsDoubly Linked List || Operations || Algorithms
Doubly Linked List || Operations || Algorithms
Shubham Sharma
 
Binary Search Tree
Binary Search TreeBinary Search Tree
Binary Search Tree
sagar yadav
 
Linked list
Linked listLinked list
Linked list
akshat360
 
Complexity analysis in Algorithms
Complexity analysis in AlgorithmsComplexity analysis in Algorithms
Complexity analysis in Algorithms
Daffodil International University
 
Data Structure (Queue)
Data Structure (Queue)Data Structure (Queue)
Data Structure (Queue)
Adam Mukharil Bachtiar
 
queue & its applications
queue & its applicationsqueue & its applications
queue & its applications
somendra kumar
 
Doubly linked list (animated)
Doubly linked list (animated)Doubly linked list (animated)
Doubly linked list (animated)
DivyeshKumar Jagatiya
 
Quick Sort , Merge Sort , Heap Sort
Quick Sort , Merge Sort ,  Heap SortQuick Sort , Merge Sort ,  Heap Sort
Quick Sort , Merge Sort , Heap Sort
Mohammed Hussein
 
Bubble Sort Algorithm Presentation
Bubble Sort Algorithm Presentation Bubble Sort Algorithm Presentation
Bubble Sort Algorithm Presentation
AhmedAlbutty
 
Searching and sorting
Searching  and sortingSearching  and sorting
Searching and sorting
PoojithaBollikonda
 
Array data structure
Array data structureArray data structure
Array data structure
maamir farooq
 
Chapter 11 - Sorting and Searching
Chapter 11 - Sorting and SearchingChapter 11 - Sorting and Searching
Chapter 11 - Sorting and Searching
Eduardo Bergavera
 
Stack Data Structure & It's Application
Stack Data Structure & It's Application Stack Data Structure & It's Application
Stack Data Structure & It's Application
Tech_MX
 
Selection sort
Selection sortSelection sort
Selection sort
stella D
 
Stacks IN DATA STRUCTURES
Stacks IN DATA STRUCTURESStacks IN DATA STRUCTURES
Stacks IN DATA STRUCTURES
Sowmya Jyothi
 
Stack and its Applications : Data Structures ADT
Stack and its Applications : Data Structures ADTStack and its Applications : Data Structures ADT
Stack and its Applications : Data Structures ADT
Soumen Santra
 
Binary search tree in data structures
Binary search tree in  data structuresBinary search tree in  data structures
Binary search tree in data structures
chauhankapil
 
Doubly Linked List || Operations || Algorithms
Doubly Linked List || Operations || AlgorithmsDoubly Linked List || Operations || Algorithms
Doubly Linked List || Operations || Algorithms
Shubham Sharma
 
Binary Search Tree
Binary Search TreeBinary Search Tree
Binary Search Tree
sagar yadav
 
queue & its applications
queue & its applicationsqueue & its applications
queue & its applications
somendra kumar
 
Quick Sort , Merge Sort , Heap Sort
Quick Sort , Merge Sort ,  Heap SortQuick Sort , Merge Sort ,  Heap Sort
Quick Sort , Merge Sort , Heap Sort
Mohammed Hussein
 
Bubble Sort Algorithm Presentation
Bubble Sort Algorithm Presentation Bubble Sort Algorithm Presentation
Bubble Sort Algorithm Presentation
AhmedAlbutty
 
Array data structure
Array data structureArray data structure
Array data structure
maamir farooq
 
Chapter 11 - Sorting and Searching
Chapter 11 - Sorting and SearchingChapter 11 - Sorting and Searching
Chapter 11 - Sorting and Searching
Eduardo Bergavera
 

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

Linked stack-and-linked-queue
Linked stack-and-linked-queueLinked stack-and-linked-queue
Linked stack-and-linked-queue
soniasharmafdp
 
stacks and queues
stacks and queuesstacks and queues
stacks and queues
EktaVaswani2
 
Queue and its operations
Queue and its operationsQueue and its operations
Queue and its operations
V.V.Vanniaperumal College for Women
 
VCE Unit 03vv.pptx
VCE Unit 03vv.pptxVCE Unit 03vv.pptx
VCE Unit 03vv.pptx
skilljiolms
 
chapter10-queue-161018120329.pdf
chapter10-queue-161018120329.pdfchapter10-queue-161018120329.pdf
chapter10-queue-161018120329.pdf
ssuserff72e4
 
STACK, LINKED LIST ,AND QUEUE
STACK, LINKED LIST ,AND QUEUESTACK, LINKED LIST ,AND QUEUE
STACK, LINKED LIST ,AND QUEUE
Dev Chauhan
 
Stack & Queue
Stack & QueueStack & Queue
Stack & Queue
Hasan Mahadi Riaz
 
9f556226-babd-4276-b964-371c6a5a77b9.pdf
9f556226-babd-4276-b964-371c6a5a77b9.pdf9f556226-babd-4276-b964-371c6a5a77b9.pdf
9f556226-babd-4276-b964-371c6a5a77b9.pdf
kumarharsh2119hk
 
queue.pptx
queue.pptxqueue.pptx
queue.pptx
NSudhaEccs
 
Data Structures - Lecture 9 [Stack & Queue using Linked List]
 Data Structures - Lecture 9 [Stack & Queue using Linked List] Data Structures - Lecture 9 [Stack & Queue using Linked List]
Data Structures - Lecture 9 [Stack & Queue using Linked List]
Muhammad Hammad Waseem
 
unit 5 stack & queue.ppt
unit 5 stack & queue.pptunit 5 stack & queue.ppt
unit 5 stack & queue.ppt
SeethaDinesh
 
6.queue
6.queue6.queue
6.queue
Chandan Singh
 
CDS artificial intelligence and Machine.docx
CDS artificial intelligence and Machine.docxCDS artificial intelligence and Machine.docx
CDS artificial intelligence and Machine.docx
msurfudeen6681
 
Queue
QueueQueue
Queue
pooja kumari
 
queue
queuequeue
queue
umair khan
 
Lecture 7 data structures and algorithms
Lecture 7 data structures and algorithmsLecture 7 data structures and algorithms
Lecture 7 data structures and algorithms
Aakash deep Singhal
 
Stacks queues-1220971554378778-9
Stacks queues-1220971554378778-9Stacks queues-1220971554378778-9
Stacks queues-1220971554378778-9
Getachew Ganfur
 
Rana Junaid Rasheed
Rana Junaid RasheedRana Junaid Rasheed
Rana Junaid Rasheed
Rana junaid Rasheed
 
introduction of the Stacks and Queues.pptx
introduction of the  Stacks and Queues.pptxintroduction of the  Stacks and Queues.pptx
introduction of the Stacks and Queues.pptx
kavitashingi123
 
Bsc cs ii dfs u-2 linklist,stack,queue
Bsc cs ii  dfs u-2 linklist,stack,queueBsc cs ii  dfs u-2 linklist,stack,queue
Bsc cs ii dfs u-2 linklist,stack,queue
Rai University
 
Linked stack-and-linked-queue
Linked stack-and-linked-queueLinked stack-and-linked-queue
Linked stack-and-linked-queue
soniasharmafdp
 
VCE Unit 03vv.pptx
VCE Unit 03vv.pptxVCE Unit 03vv.pptx
VCE Unit 03vv.pptx
skilljiolms
 
chapter10-queue-161018120329.pdf
chapter10-queue-161018120329.pdfchapter10-queue-161018120329.pdf
chapter10-queue-161018120329.pdf
ssuserff72e4
 
STACK, LINKED LIST ,AND QUEUE
STACK, LINKED LIST ,AND QUEUESTACK, LINKED LIST ,AND QUEUE
STACK, LINKED LIST ,AND QUEUE
Dev Chauhan
 
9f556226-babd-4276-b964-371c6a5a77b9.pdf
9f556226-babd-4276-b964-371c6a5a77b9.pdf9f556226-babd-4276-b964-371c6a5a77b9.pdf
9f556226-babd-4276-b964-371c6a5a77b9.pdf
kumarharsh2119hk
 
Data Structures - Lecture 9 [Stack & Queue using Linked List]
 Data Structures - Lecture 9 [Stack & Queue using Linked List] Data Structures - Lecture 9 [Stack & Queue using Linked List]
Data Structures - Lecture 9 [Stack & Queue using Linked List]
Muhammad Hammad Waseem
 
unit 5 stack & queue.ppt
unit 5 stack & queue.pptunit 5 stack & queue.ppt
unit 5 stack & queue.ppt
SeethaDinesh
 
CDS artificial intelligence and Machine.docx
CDS artificial intelligence and Machine.docxCDS artificial intelligence and Machine.docx
CDS artificial intelligence and Machine.docx
msurfudeen6681
 
Lecture 7 data structures and algorithms
Lecture 7 data structures and algorithmsLecture 7 data structures and algorithms
Lecture 7 data structures and algorithms
Aakash deep Singhal
 
Stacks queues-1220971554378778-9
Stacks queues-1220971554378778-9Stacks queues-1220971554378778-9
Stacks queues-1220971554378778-9
Getachew Ganfur
 
introduction of the Stacks and Queues.pptx
introduction of the  Stacks and Queues.pptxintroduction of the  Stacks and Queues.pptx
introduction of the Stacks and Queues.pptx
kavitashingi123
 
Bsc cs ii dfs u-2 linklist,stack,queue
Bsc cs ii  dfs u-2 linklist,stack,queueBsc cs ii  dfs u-2 linklist,stack,queue
Bsc cs ii dfs u-2 linklist,stack,queue
Rai University
 
Ad

More from Meghaj Mallick (20)

24 partial-orderings
24 partial-orderings24 partial-orderings
24 partial-orderings
Meghaj Mallick
 
PORTFOLIO BY USING HTML & CSS
PORTFOLIO BY USING HTML & CSSPORTFOLIO BY USING HTML & CSS
PORTFOLIO BY USING HTML & CSS
Meghaj Mallick
 
Introduction to Software Testing
Introduction to Software TestingIntroduction to Software Testing
Introduction to Software Testing
Meghaj Mallick
 
Introduction to System Programming
Introduction to System ProgrammingIntroduction to System Programming
Introduction to System Programming
Meghaj Mallick
 
MACRO ASSEBLER
MACRO ASSEBLERMACRO ASSEBLER
MACRO ASSEBLER
Meghaj Mallick
 
Icons, Image & Multimedia
Icons, Image & MultimediaIcons, Image & Multimedia
Icons, Image & Multimedia
Meghaj Mallick
 
Project Tracking & SPC
Project Tracking & SPCProject Tracking & SPC
Project Tracking & SPC
Meghaj Mallick
 
Peephole Optimization
Peephole OptimizationPeephole Optimization
Peephole Optimization
Meghaj Mallick
 
Routing in MANET
Routing in MANETRouting in MANET
Routing in MANET
Meghaj Mallick
 
Macro assembler
 Macro assembler Macro assembler
Macro assembler
Meghaj Mallick
 
Architecture and security in Vanet PPT
Architecture and security in Vanet PPTArchitecture and security in Vanet PPT
Architecture and security in Vanet PPT
Meghaj Mallick
 
Design Model & User Interface Design in Software Engineering
Design Model & User Interface Design in Software EngineeringDesign Model & User Interface Design in Software Engineering
Design Model & User Interface Design in Software Engineering
Meghaj Mallick
 
Text Mining of Twitter in Data Mining
Text Mining of Twitter in Data MiningText Mining of Twitter in Data Mining
Text Mining of Twitter in Data Mining
Meghaj Mallick
 
DFS & BFS in Computer Algorithm
DFS & BFS in Computer AlgorithmDFS & BFS in Computer Algorithm
DFS & BFS in Computer Algorithm
Meghaj Mallick
 
Software Development Method
Software Development MethodSoftware Development Method
Software Development Method
Meghaj Mallick
 
Secant method in Numerical & Statistical Method
Secant method in Numerical & Statistical MethodSecant method in Numerical & Statistical Method
Secant method in Numerical & Statistical Method
Meghaj Mallick
 
Motivation in Organization
Motivation in OrganizationMotivation in Organization
Motivation in Organization
Meghaj Mallick
 
Communication Skill
Communication SkillCommunication Skill
Communication Skill
Meghaj Mallick
 
Partial-Orderings in Discrete Mathematics
 Partial-Orderings in Discrete Mathematics Partial-Orderings in Discrete Mathematics
Partial-Orderings in Discrete Mathematics
Meghaj Mallick
 
Hashing In Data Structure
Hashing In Data Structure Hashing In Data Structure
Hashing In Data Structure
Meghaj Mallick
 
PORTFOLIO BY USING HTML & CSS
PORTFOLIO BY USING HTML & CSSPORTFOLIO BY USING HTML & CSS
PORTFOLIO BY USING HTML & CSS
Meghaj Mallick
 
Introduction to Software Testing
Introduction to Software TestingIntroduction to Software Testing
Introduction to Software Testing
Meghaj Mallick
 
Introduction to System Programming
Introduction to System ProgrammingIntroduction to System Programming
Introduction to System Programming
Meghaj Mallick
 
Icons, Image & Multimedia
Icons, Image & MultimediaIcons, Image & Multimedia
Icons, Image & Multimedia
Meghaj Mallick
 
Project Tracking & SPC
Project Tracking & SPCProject Tracking & SPC
Project Tracking & SPC
Meghaj Mallick
 
Architecture and security in Vanet PPT
Architecture and security in Vanet PPTArchitecture and security in Vanet PPT
Architecture and security in Vanet PPT
Meghaj Mallick
 
Design Model & User Interface Design in Software Engineering
Design Model & User Interface Design in Software EngineeringDesign Model & User Interface Design in Software Engineering
Design Model & User Interface Design in Software Engineering
Meghaj Mallick
 
Text Mining of Twitter in Data Mining
Text Mining of Twitter in Data MiningText Mining of Twitter in Data Mining
Text Mining of Twitter in Data Mining
Meghaj Mallick
 
DFS & BFS in Computer Algorithm
DFS & BFS in Computer AlgorithmDFS & BFS in Computer Algorithm
DFS & BFS in Computer Algorithm
Meghaj Mallick
 
Software Development Method
Software Development MethodSoftware Development Method
Software Development Method
Meghaj Mallick
 
Secant method in Numerical & Statistical Method
Secant method in Numerical & Statistical MethodSecant method in Numerical & Statistical Method
Secant method in Numerical & Statistical Method
Meghaj Mallick
 
Motivation in Organization
Motivation in OrganizationMotivation in Organization
Motivation in Organization
Meghaj Mallick
 
Partial-Orderings in Discrete Mathematics
 Partial-Orderings in Discrete Mathematics Partial-Orderings in Discrete Mathematics
Partial-Orderings in Discrete Mathematics
Meghaj Mallick
 
Hashing In Data Structure
Hashing In Data Structure Hashing In Data Structure
Hashing In Data Structure
Meghaj Mallick
 
Ad

Recently uploaded (20)

3b. Jur Erbrink - session 3 pitch.pdf Presentatie CIRED Voorbereidingsdag
3b. Jur Erbrink - session 3 pitch.pdf Presentatie CIRED Voorbereidingsdag3b. Jur Erbrink - session 3 pitch.pdf Presentatie CIRED Voorbereidingsdag
3b. Jur Erbrink - session 3 pitch.pdf Presentatie CIRED Voorbereidingsdag
Dutch Power
 
presentacion de Inspire Power Point.pptx
presentacion de Inspire Power Point.pptxpresentacion de Inspire Power Point.pptx
presentacion de Inspire Power Point.pptx
teamspro
 
Media of Advertisement-How to choose it.pptx
Media of Advertisement-How to choose it.pptxMedia of Advertisement-How to choose it.pptx
Media of Advertisement-How to choose it.pptx
bugisatrioadiwibowo
 
Presenation - compensation plan - Mining Race - NEW - June 2025
Presenation - compensation plan - Mining Race - NEW - June 2025Presenation - compensation plan - Mining Race - NEW - June 2025
Presenation - compensation plan - Mining Race - NEW - June 2025
Mining RACE
 
Pentecost Sunday A Promise of Power.pptx
Pentecost Sunday A Promise of Power.pptxPentecost Sunday A Promise of Power.pptx
Pentecost Sunday A Promise of Power.pptx
FamilyWorshipCenterD
 
2025-06-08 Abraham 02 (shared slides).pptx
2025-06-08 Abraham 02 (shared slides).pptx2025-06-08 Abraham 02 (shared slides).pptx
2025-06-08 Abraham 02 (shared slides).pptx
Dale Wells
 
THE INTERIOR REVIEW MEDIA KIT - THE INTERIOR REVIEW
THE INTERIOR REVIEW MEDIA KIT - THE INTERIOR REVIEWTHE INTERIOR REVIEW MEDIA KIT - THE INTERIOR REVIEW
THE INTERIOR REVIEW MEDIA KIT - THE INTERIOR REVIEW
rspyamin
 
AI Intelligence: Exploring the Future of Artificial Intelligence
AI Intelligence: Exploring the Future of Artificial IntelligenceAI Intelligence: Exploring the Future of Artificial Intelligence
AI Intelligence: Exploring the Future of Artificial Intelligence
sayalikerimova20
 
FUTURE OF FITNESS 2025 KEYNOTE BRYAN OROURKE BEYOND ACTIV SINGAPORE 2025
FUTURE OF FITNESS 2025 KEYNOTE BRYAN OROURKE BEYOND ACTIV SINGAPORE 2025FUTURE OF FITNESS 2025 KEYNOTE BRYAN OROURKE BEYOND ACTIV SINGAPORE 2025
FUTURE OF FITNESS 2025 KEYNOTE BRYAN OROURKE BEYOND ACTIV SINGAPORE 2025
Bryan K. O'Rourke
 
ART INTAGRATED PROJECT in chemistry about resources
ART INTAGRATED PROJECT in chemistry about resourcesART INTAGRATED PROJECT in chemistry about resources
ART INTAGRATED PROJECT in chemistry about resources
mcarchana74
 
3d. Alejandra Jimenz Rosales - Session 3 pitch.pdf
3d. Alejandra Jimenz Rosales - Session 3 pitch.pdf3d. Alejandra Jimenz Rosales - Session 3 pitch.pdf
3d. Alejandra Jimenz Rosales - Session 3 pitch.pdf
Dutch Power
 
Diddy Baby oil making tutorial (natural ingresients.pptx
Diddy Baby oil making tutorial (natural ingresients.pptxDiddy Baby oil making tutorial (natural ingresients.pptx
Diddy Baby oil making tutorial (natural ingresients.pptx
RanitMal
 
Assesement_PPT Designer -----------Final
Assesement_PPT Designer -----------FinalAssesement_PPT Designer -----------Final
Assesement_PPT Designer -----------Final
RajeshKumarKumre
 
3e. Leoni Winschermann - session 3 pitch.pdf
3e. Leoni Winschermann - session 3 pitch.pdf3e. Leoni Winschermann - session 3 pitch.pdf
3e. Leoni Winschermann - session 3 pitch.pdf
Dutch Power
 
Apresentação sobre a Marinha do Brasil .
Apresentação sobre a Marinha do Brasil  .Apresentação sobre a Marinha do Brasil  .
Apresentação sobre a Marinha do Brasil .
romulobfernandes
 
Jadual Waktu dan Jadual Bertugas kelas.pptx
Jadual Waktu dan Jadual Bertugas kelas.pptxJadual Waktu dan Jadual Bertugas kelas.pptx
Jadual Waktu dan Jadual Bertugas kelas.pptx
roslan17
 
Seminar Presented by Natnael Dechasa Title: Brain Cheat Codes: The Science-Ba...
Seminar Presented by Natnael Dechasa Title: Brain Cheat Codes: The Science-Ba...Seminar Presented by Natnael Dechasa Title: Brain Cheat Codes: The Science-Ba...
Seminar Presented by Natnael Dechasa Title: Brain Cheat Codes: The Science-Ba...
Nati1986
 
Streamline English Destinations.pdf for ev
Streamline English Destinations.pdf for evStreamline English Destinations.pdf for ev
Streamline English Destinations.pdf for ev
PhuongNguyen180931
 
How Does a Configuration Management Plan Mitigate Risks?
How Does a Configuration Management Plan Mitigate Risks?How Does a Configuration Management Plan Mitigate Risks?
How Does a Configuration Management Plan Mitigate Risks?
Writegenic AI
 
Timothy J. Los, JD, LL.M. (Tax) – Global Investor, Family Office & Profession...
Timothy J. Los, JD, LL.M. (Tax) – Global Investor, Family Office & Profession...Timothy J. Los, JD, LL.M. (Tax) – Global Investor, Family Office & Profession...
Timothy J. Los, JD, LL.M. (Tax) – Global Investor, Family Office & Profession...
Timothy Los
 
3b. Jur Erbrink - session 3 pitch.pdf Presentatie CIRED Voorbereidingsdag
3b. Jur Erbrink - session 3 pitch.pdf Presentatie CIRED Voorbereidingsdag3b. Jur Erbrink - session 3 pitch.pdf Presentatie CIRED Voorbereidingsdag
3b. Jur Erbrink - session 3 pitch.pdf Presentatie CIRED Voorbereidingsdag
Dutch Power
 
presentacion de Inspire Power Point.pptx
presentacion de Inspire Power Point.pptxpresentacion de Inspire Power Point.pptx
presentacion de Inspire Power Point.pptx
teamspro
 
Media of Advertisement-How to choose it.pptx
Media of Advertisement-How to choose it.pptxMedia of Advertisement-How to choose it.pptx
Media of Advertisement-How to choose it.pptx
bugisatrioadiwibowo
 
Presenation - compensation plan - Mining Race - NEW - June 2025
Presenation - compensation plan - Mining Race - NEW - June 2025Presenation - compensation plan - Mining Race - NEW - June 2025
Presenation - compensation plan - Mining Race - NEW - June 2025
Mining RACE
 
Pentecost Sunday A Promise of Power.pptx
Pentecost Sunday A Promise of Power.pptxPentecost Sunday A Promise of Power.pptx
Pentecost Sunday A Promise of Power.pptx
FamilyWorshipCenterD
 
2025-06-08 Abraham 02 (shared slides).pptx
2025-06-08 Abraham 02 (shared slides).pptx2025-06-08 Abraham 02 (shared slides).pptx
2025-06-08 Abraham 02 (shared slides).pptx
Dale Wells
 
THE INTERIOR REVIEW MEDIA KIT - THE INTERIOR REVIEW
THE INTERIOR REVIEW MEDIA KIT - THE INTERIOR REVIEWTHE INTERIOR REVIEW MEDIA KIT - THE INTERIOR REVIEW
THE INTERIOR REVIEW MEDIA KIT - THE INTERIOR REVIEW
rspyamin
 
AI Intelligence: Exploring the Future of Artificial Intelligence
AI Intelligence: Exploring the Future of Artificial IntelligenceAI Intelligence: Exploring the Future of Artificial Intelligence
AI Intelligence: Exploring the Future of Artificial Intelligence
sayalikerimova20
 
FUTURE OF FITNESS 2025 KEYNOTE BRYAN OROURKE BEYOND ACTIV SINGAPORE 2025
FUTURE OF FITNESS 2025 KEYNOTE BRYAN OROURKE BEYOND ACTIV SINGAPORE 2025FUTURE OF FITNESS 2025 KEYNOTE BRYAN OROURKE BEYOND ACTIV SINGAPORE 2025
FUTURE OF FITNESS 2025 KEYNOTE BRYAN OROURKE BEYOND ACTIV SINGAPORE 2025
Bryan K. O'Rourke
 
ART INTAGRATED PROJECT in chemistry about resources
ART INTAGRATED PROJECT in chemistry about resourcesART INTAGRATED PROJECT in chemistry about resources
ART INTAGRATED PROJECT in chemistry about resources
mcarchana74
 
3d. Alejandra Jimenz Rosales - Session 3 pitch.pdf
3d. Alejandra Jimenz Rosales - Session 3 pitch.pdf3d. Alejandra Jimenz Rosales - Session 3 pitch.pdf
3d. Alejandra Jimenz Rosales - Session 3 pitch.pdf
Dutch Power
 
Diddy Baby oil making tutorial (natural ingresients.pptx
Diddy Baby oil making tutorial (natural ingresients.pptxDiddy Baby oil making tutorial (natural ingresients.pptx
Diddy Baby oil making tutorial (natural ingresients.pptx
RanitMal
 
Assesement_PPT Designer -----------Final
Assesement_PPT Designer -----------FinalAssesement_PPT Designer -----------Final
Assesement_PPT Designer -----------Final
RajeshKumarKumre
 
3e. Leoni Winschermann - session 3 pitch.pdf
3e. Leoni Winschermann - session 3 pitch.pdf3e. Leoni Winschermann - session 3 pitch.pdf
3e. Leoni Winschermann - session 3 pitch.pdf
Dutch Power
 
Apresentação sobre a Marinha do Brasil .
Apresentação sobre a Marinha do Brasil  .Apresentação sobre a Marinha do Brasil  .
Apresentação sobre a Marinha do Brasil .
romulobfernandes
 
Jadual Waktu dan Jadual Bertugas kelas.pptx
Jadual Waktu dan Jadual Bertugas kelas.pptxJadual Waktu dan Jadual Bertugas kelas.pptx
Jadual Waktu dan Jadual Bertugas kelas.pptx
roslan17
 
Seminar Presented by Natnael Dechasa Title: Brain Cheat Codes: The Science-Ba...
Seminar Presented by Natnael Dechasa Title: Brain Cheat Codes: The Science-Ba...Seminar Presented by Natnael Dechasa Title: Brain Cheat Codes: The Science-Ba...
Seminar Presented by Natnael Dechasa Title: Brain Cheat Codes: The Science-Ba...
Nati1986
 
Streamline English Destinations.pdf for ev
Streamline English Destinations.pdf for evStreamline English Destinations.pdf for ev
Streamline English Destinations.pdf for ev
PhuongNguyen180931
 
How Does a Configuration Management Plan Mitigate Risks?
How Does a Configuration Management Plan Mitigate Risks?How Does a Configuration Management Plan Mitigate Risks?
How Does a Configuration Management Plan Mitigate Risks?
Writegenic AI
 
Timothy J. Los, JD, LL.M. (Tax) – Global Investor, Family Office & Profession...
Timothy J. Los, JD, LL.M. (Tax) – Global Investor, Family Office & Profession...Timothy J. Los, JD, LL.M. (Tax) – Global Investor, Family Office & Profession...
Timothy J. Los, JD, LL.M. (Tax) – Global Investor, Family Office & Profession...
Timothy Los
 

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: