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
Kruskal’s algorithm
PPTX
PPTX
Stacks in c++
PDF
Lecture 2 agent and environment
PPTX
Pointer in C++
PPTX
Map reduce presentation
PDF
Algorithms and Data Structure 2020
PPTX
Presentation on K-Means Clustering
Kruskal’s algorithm
Stacks in c++
Lecture 2 agent and environment
Pointer in C++
Map reduce presentation
Algorithms and Data Structure 2020
Presentation on K-Means Clustering

What's hot (20)

PPTX
heap Sort Algorithm
PPTX
Data Structures - Lecture 9 [Stack & Queue using Linked List]
PPTX
Doubly Linked List
PPTX
Priority queue in DSA
PPT
Binary search tree in data structures
PPT
Linked lists
PPTX
PPT
Heap sort
PPTX
Binary Search Tree
PPT
SEARCHING AND SORTING ALGORITHMS
PPTX
Queue Implementation Using Array & Linked List
PPTX
linked list
PPTX
Stack and Queue
PPTX
Linked List
PPTX
Circular link list.ppt
PPTX
Heap Sort in Design and Analysis of algorithms
PPTX
Searching and sorting
PPT
Data Structures- Part5 recursion
PPTX
Graph traversals in Data Structures
heap Sort Algorithm
Data Structures - Lecture 9 [Stack & Queue using Linked List]
Doubly Linked List
Priority queue in DSA
Binary search tree in data structures
Linked lists
Heap sort
Binary Search Tree
SEARCHING AND SORTING ALGORITHMS
Queue Implementation Using Array & Linked List
linked list
Stack and Queue
Linked List
Circular link list.ppt
Heap Sort in Design and Analysis of algorithms
Searching and sorting
Data Structures- Part5 recursion
Graph traversals in Data Structures
Ad

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

PPTX
Queues presentation
PDF
stacks and queues
PPTX
Stack and Queue.pptx university exam preparation
PDF
Linked stack-and-linked-queue
PPT
Stacks & Queues
PPT
Stacks & Queues By Ms. Niti Arora
PPTX
Stack & Queue in Data Structure and Algorithms
PPTX
Data structures1
PPTX
PDF
C++ Program It is only 1 rotation. Up-rotation of a stack. Write a.pdf
PPTX
Abscddnddmdkwkkstack implementation.pptx
PDF
Stack push pop
PPTX
Stack data structure
PDF
Data structures stacks
PDF
Queues and Stacks
PDF
Stacks,queues,linked-list
PPTX
Lec5-Stack-bukc-28022024-112316am (1) .pptx
PPT
Stack queue
PPT
Stack queue
PPT
Stack queue
Queues presentation
stacks and queues
Stack and Queue.pptx university exam preparation
Linked stack-and-linked-queue
Stacks & Queues
Stacks & Queues By Ms. Niti Arora
Stack & Queue in Data Structure and Algorithms
Data structures1
C++ Program It is only 1 rotation. Up-rotation of a stack. Write a.pdf
Abscddnddmdkwkkstack implementation.pptx
Stack push pop
Stack data structure
Data structures stacks
Queues and Stacks
Stacks,queues,linked-list
Lec5-Stack-bukc-28022024-112316am (1) .pptx
Stack queue
Stack queue
Stack queue
Ad

More from Meghaj Mallick (20)

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

Recently uploaded (20)

PPTX
Hydrogel Based delivery Cancer Treatment
DOC
学位双硕士UTAS毕业证,墨尔本理工学院毕业证留学硕士毕业证
PPTX
Learning-Plan-5-Policies-and-Practices.pptx
PPTX
Self management and self evaluation presentation
PPTX
fundraisepro pitch deck elegant and modern
PPTX
INTERNATIONAL LABOUR ORAGNISATION PPT ON SOCIAL SCIENCE
PPTX
Emphasizing It's Not The End 08 06 2025.pptx
PDF
Instagram's Product Secrets Unveiled with this PPT
PPTX
An Unlikely Response 08 10 2025.pptx
PPTX
AcademyNaturalLanguageProcessing-EN-ILT-M02-Introduction.pptx
PPTX
Effective_Handling_Information_Presentation.pptx
PDF
Why Top Brands Trust Enuncia Global for Language Solutions.pdf
PPTX
Understanding-Communication-Berlos-S-M-C-R-Model.pptx
PPTX
Human Mind & its character Characteristics
PDF
Swiggy’s Playbook: UX, Logistics & Monetization
DOCX
ENGLISH PROJECT FOR BINOD BIHARI MAHTO KOYLANCHAL UNIVERSITY
PPTX
worship songs, in any order, compilation
PDF
oil_refinery_presentation_v1 sllfmfls.pdf
PPTX
Non-Verbal-Communication .mh.pdf_110245_compressed.pptx
PPTX
Primary and secondary sources, and history
Hydrogel Based delivery Cancer Treatment
学位双硕士UTAS毕业证,墨尔本理工学院毕业证留学硕士毕业证
Learning-Plan-5-Policies-and-Practices.pptx
Self management and self evaluation presentation
fundraisepro pitch deck elegant and modern
INTERNATIONAL LABOUR ORAGNISATION PPT ON SOCIAL SCIENCE
Emphasizing It's Not The End 08 06 2025.pptx
Instagram's Product Secrets Unveiled with this PPT
An Unlikely Response 08 10 2025.pptx
AcademyNaturalLanguageProcessing-EN-ILT-M02-Introduction.pptx
Effective_Handling_Information_Presentation.pptx
Why Top Brands Trust Enuncia Global for Language Solutions.pdf
Understanding-Communication-Berlos-S-M-C-R-Model.pptx
Human Mind & its character Characteristics
Swiggy’s Playbook: UX, Logistics & Monetization
ENGLISH PROJECT FOR BINOD BIHARI MAHTO KOYLANCHAL UNIVERSITY
worship songs, in any order, compilation
oil_refinery_presentation_v1 sllfmfls.pdf
Non-Verbal-Communication .mh.pdf_110245_compressed.pptx
Primary and secondary sources, and history

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: