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

PPT
Expression evaluation
PPTX
Stack and Queue
PPTX
Stack using Array
PPTX
Circular linked list
PPT
Unit 3 Tree chapter 5
PPTX
Unit I-Data structures stack & Queue
PPTX
Balanced Tree (AVL Tree & Red-Black Tree)
PPTX
Heap sort
Expression evaluation
Stack and Queue
Stack using Array
Circular linked list
Unit 3 Tree chapter 5
Unit I-Data structures stack & Queue
Balanced Tree (AVL Tree & Red-Black Tree)
Heap sort

What's hot (20)

PPTX
Data Structures - Lecture 9 [Stack & Queue using Linked List]
PPTX
Linked List
PPTX
trees in data structure
PPTX
Linked list
PPTX
Abstract Data Types
PPT
DATA STRUCTURES
PPT
PPTX
PPTX
Linked List - Insertion & Deletion
PPTX
Stacks IN DATA STRUCTURES
PPSX
PPTX
linked list in Data Structure, Simple and Easy Tutorial
PPTX
Doubly Linked List
PPTX
AVL Tree in Data Structure
PPT
Doubly linked list
PDF
linked lists in data structures
PPTX
linked list in data structure
PPT
Data Structure and Algorithms Binary Search Tree
PPTX
single linked list
PPTX
Circular link list.ppt
Data Structures - Lecture 9 [Stack & Queue using Linked List]
Linked List
trees in data structure
Linked list
Abstract Data Types
DATA STRUCTURES
Linked List - Insertion & Deletion
Stacks IN DATA STRUCTURES
linked list in Data Structure, Simple and Easy Tutorial
Doubly Linked List
AVL Tree in Data Structure
Doubly linked list
linked lists in data structures
linked list in data structure
Data Structure and Algorithms Binary Search Tree
single linked list
Circular link list.ppt
Ad

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

PDF
Linked stack-and-linked-queue
PPTX
stacks and queues
PPTX
Queue and its operations
PPTX
VCE Unit 03vv.pptx
PPSX
Data Structure (Queue)
PDF
chapter10-queue-161018120329.pdf
PPTX
STACK, LINKED LIST ,AND QUEUE
PPTX
Stack & Queue
PDF
9f556226-babd-4276-b964-371c6a5a77b9.pdf
PPTX
queue.pptx
PPT
Lec-07 Queues.ppt queues introduction to queue
PPT
unit 5 stack & queue.ppt
PPTX
6.queue
DOCX
CDS artificial intelligence and Machine.docx
PDF
PPTX
queue
PPTX
Lecture 7 data structures and algorithms
PPT
Rana Junaid Rasheed
PPT
Stacks queues-1220971554378778-9
PPTX
introduction of the Stacks and Queues.pptx
Linked stack-and-linked-queue
stacks and queues
Queue and its operations
VCE Unit 03vv.pptx
Data Structure (Queue)
chapter10-queue-161018120329.pdf
STACK, LINKED LIST ,AND QUEUE
Stack & Queue
9f556226-babd-4276-b964-371c6a5a77b9.pdf
queue.pptx
Lec-07 Queues.ppt queues introduction to queue
unit 5 stack & queue.ppt
6.queue
CDS artificial intelligence and Machine.docx
queue
Lecture 7 data structures and algorithms
Rana Junaid Rasheed
Stacks queues-1220971554378778-9
introduction of the Stacks and Queues.pptx
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
Research Process - Research Methods course
PPTX
Kompem Part Untuk MK Komunikasi Pembangunan 5.pptx
PPTX
CAPE CARIBBEAN STUDIES- Integration-1.pptx
PPTX
Shizophrnia ppt for clinical psychology students of AS
PPTX
Copy- of-Lesson-6-Digestive-System.pptx
PDF
PM Narendra Modi's speech from Red Fort on 79th Independence Day.pdf
PPT
Lessons from Presentation Zen_ how to craft your story visually
PDF
_Nature and dynamics of communities and community development .pdf
PPTX
INDIGENOUS-LANGUAGES-AND-LITERATURE.pptx
PPTX
Sustainable Forest Management ..SFM.pptx
PDF
Unnecessary information is required for the
PPTX
Phylogeny and disease transmission of Dipteran Fly (ppt).pptx
PDF
Module 7 guard mounting of security pers
PDF
6.-propertise of noble gases, uses and isolation in noble gases
PPTX
Phylogeny and disease transmission of Dipteran Fly (ppt).pptx
PPTX
Rakhi Presentation vbbrfferregergrgerg.pptx
PPTX
power point presentation ofDracena species.pptx
DOC
EVC毕业证学历认证,北密歇根大学毕业证留学硕士毕业证
PDF
IKS PPT.....................................
PPTX
NORMAN_RESEARCH_PRESENTATION.in education
Research Process - Research Methods course
Kompem Part Untuk MK Komunikasi Pembangunan 5.pptx
CAPE CARIBBEAN STUDIES- Integration-1.pptx
Shizophrnia ppt for clinical psychology students of AS
Copy- of-Lesson-6-Digestive-System.pptx
PM Narendra Modi's speech from Red Fort on 79th Independence Day.pdf
Lessons from Presentation Zen_ how to craft your story visually
_Nature and dynamics of communities and community development .pdf
INDIGENOUS-LANGUAGES-AND-LITERATURE.pptx
Sustainable Forest Management ..SFM.pptx
Unnecessary information is required for the
Phylogeny and disease transmission of Dipteran Fly (ppt).pptx
Module 7 guard mounting of security pers
6.-propertise of noble gases, uses and isolation in noble gases
Phylogeny and disease transmission of Dipteran Fly (ppt).pptx
Rakhi Presentation vbbrfferregergrgerg.pptx
power point presentation ofDracena species.pptx
EVC毕业证学历认证,北密歇根大学毕业证留学硕士毕业证
IKS PPT.....................................
NORMAN_RESEARCH_PRESENTATION.in education

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: