SlideShare a Scribd company logo
STACK
DATA
STRUCTURE
LINEAR DATA
STRUCTURE
ARRAY QUEUE STACK
NON LINEAR
DATA
STRUCTURE
What is Linear Data Structure
๏ƒ˜In linear data structure, data is arranged
in linear sequence.
๏ƒ˜ Data items can be traversed in a single
run.
๏ƒ˜ In linear data structure elements are
accessed or placed in contiguous(together
in sequence) memory location.
WHAT Is
๏ƒ˜ A stack is called a last-in-first-out (LIFO)
collection. This means that the last thing
we added (pushed) is the first thing that
gets pulled (popped) off.
A stack is a sequence of items that are
accessible at only one end of the sequence.
Definition of Stack:
Stacks in Data Structures is a linear type
of data structure that follows the LIFO
(Last-In-First-Out) principle and allows
insertion and deletion operations from
one end of the stack data structure, that
is top.
If any Element inserted then Top will be
increased by 1 & if any Element deleted
then Top will be decreased by 1.
Top=Top+1 (Insertion)
Top=Top-1 (Deletion)
EXAMPLES OF STACK:
Operations that can be performed
on STACK:
๏ƒ˜ PUSH.
๏ƒ˜ POP.
PUSH : It is used to insert items into the stack.
POP: It is used to delete items from stack.
TOP: It represents the current location of data
in stack.
ALGORITHM OF INSERTION IN
STACK: (PUSH)
1. Insertion(a,top,item,max)
2. If top=max then
print โ€˜STACK OVERFLOWโ€™
exit
else
3. top=top+1
end if
4. a[top]=item
5. Exit
ALGORITHM OF DELETION IN
STACK: (POP)
1. Deletion(a,top,item)
2. If top=0 then
print โ€˜STACK UNDERFLOWโ€™
exit
else
3. item=a[top]
end if
4 . top=top-1
5. Exit
ALGORITHM OF DISPLAY IN
STACK:
1.Display(top,i,a[i])
2.If top=0 then
Print โ€˜STACK EMPTYโ€™
Exit
Else
3.For i=top to 0
Print a[i]
End for
4.exit
APPLICATIONS OF STACKS ARE:
I. Reversing Strings:
โ€ข A simple application of stack is reversing strings.
To reverse a string , the characters of string are
pushed onto the stack one by one as the string
is read from left to right.
โ€ข Once all the characters
of string are pushed onto stack, they are
popped one by one. Since the character last
pushed in comes out first, subsequent pop
operation results in the reversal of the string.
For example:
To reverse the string โ€˜REVERSEโ€™ the string is
read from left to right and its characters are
pushed . LIKE:
onto a stack.
II. Checking the validity of an expression
containing nested parenthesis:
โ€ข Stacks are also used to check whether a given
arithmetic expressions containing nested
parenthesis is properly parenthesized.
โ€ข The program for checking the validity of an
expression verifies that for each left parenthesis
braces or bracket ,there is a corresponding
closing symbol and symbols are appropriately
nested.
For example:
VALID INPUTS INVALID INPUTS
{ } { ( }
( { [ ] } ) ( [ ( ( ) ] )
{ [ ] ( ) } { } [ ] )
[ { ( { } [ ] ( { [ { ) } ( ] } ]
})}]
III. Evaluating arithmetic expressions:
INFIX notation:
The general way of writing arithmetic
expressions is known as infix notation.
e.g, (a+b)
PREFIX notation:
e.g, +AB
POSTFIX notation:
e.g: AB+
Conversion of INFIX to POSTFIX conversion:
Example: 2+(4-1)*3
2+41-*3
2+41-3*
241-3*+
step1
step2
step3
step4
CURREN
T
SYMBOL
ACTION
PERFORME
D
STACK STATUS POSTFIX
EXPRESSIO
N
( PUSH C C 2
2 2
+ PUSH + (+ 2
( PUSH ( (+( 24
4 24
- PUSH - (+(- 241
1 POP 241-
) (+ 241-
* PUSH * (+* 241-
3 241-3
POP * 241-3*
POP + 241-3*+
CONVERSION OF INFIX INTO POSTFIX
2+(4-1)*3 into 241-3*+
THANK YOU

More Related Content

What's hot

Introduction to stack
Introduction to stackIntroduction to stack
Introduction to stack
vaibhav2910
ย 
Quick_sort1.pptx
Quick_sort1.pptxQuick_sort1.pptx
Quick_sort1.pptx
sandeep54552
ย 
My lectures circular queue
My lectures circular queueMy lectures circular queue
My lectures circular queue
Senthil Kumar
ย 
Data structure by Digvijay
Data structure by DigvijayData structure by Digvijay
Data structure by Digvijay
Digvijay Singh Karakoti
ย 
stack & queue
stack & queuestack & queue
stack & queue
manju rani
ย 
data structure(tree operations)
data structure(tree operations)data structure(tree operations)
data structure(tree operations)
Waheed Khalid
ย 
Linked List - Insertion & Deletion
Linked List - Insertion & DeletionLinked List - Insertion & Deletion
Linked List - Insertion & Deletion
Afaq Mansoor Khan
ย 
Stack a Data Structure
Stack a Data StructureStack a Data Structure
Stack a Data Structure
ForwardBlog Enewzletter
ย 
Stacks
StacksStacks
Stacks
sweta dargad
ย 
Stacks
StacksStacks
Stacks
Malainine Zaid
ย 
Unit I- Data structures Introduction, Evaluation of Algorithms, Arrays, Spars...
Unit I- Data structures Introduction, Evaluation of Algorithms, Arrays, Spars...Unit I- Data structures Introduction, Evaluation of Algorithms, Arrays, Spars...
Unit I- Data structures Introduction, Evaluation of Algorithms, Arrays, Spars...
DrkhanchanaR
ย 
Data structure - Graph
Data structure - GraphData structure - Graph
Data structure - Graph
Madhu Bala
ย 
Stacks and Queue - Data Structures
Stacks and Queue - Data StructuresStacks and Queue - Data Structures
Stacks and Queue - Data Structures
Dr. Jasmine Beulah Gnanadurai
ย 
Stack
StackStack
Stack
Zaid Shabbir
ย 
1.1 binary tree
1.1 binary tree1.1 binary tree
1.1 binary tree
Krish_ver2
ย 
Queues
QueuesQueues
Queues
Ashim Lamichhane
ย 
Queue in Data Structure
Queue in Data Structure Queue in Data Structure
Queue in Data Structure
Janki Shah
ย 
Applications of stack
Applications of stackApplications of stack
Applications of stack
eShikshak
ย 
linked list in Data Structure, Simple and Easy Tutorial
linked list in Data Structure, Simple and Easy Tutoriallinked list in Data Structure, Simple and Easy Tutorial
linked list in Data Structure, Simple and Easy Tutorial
Afzal Badshah
ย 
Hash table
Hash tableHash table
Hash table
Rajendran
ย 

What's hot (20)

Introduction to stack
Introduction to stackIntroduction to stack
Introduction to stack
ย 
Quick_sort1.pptx
Quick_sort1.pptxQuick_sort1.pptx
Quick_sort1.pptx
ย 
My lectures circular queue
My lectures circular queueMy lectures circular queue
My lectures circular queue
ย 
Data structure by Digvijay
Data structure by DigvijayData structure by Digvijay
Data structure by Digvijay
ย 
stack & queue
stack & queuestack & queue
stack & queue
ย 
data structure(tree operations)
data structure(tree operations)data structure(tree operations)
data structure(tree operations)
ย 
Linked List - Insertion & Deletion
Linked List - Insertion & DeletionLinked List - Insertion & Deletion
Linked List - Insertion & Deletion
ย 
Stack a Data Structure
Stack a Data StructureStack a Data Structure
Stack a Data Structure
ย 
Stacks
StacksStacks
Stacks
ย 
Stacks
StacksStacks
Stacks
ย 
Unit I- Data structures Introduction, Evaluation of Algorithms, Arrays, Spars...
Unit I- Data structures Introduction, Evaluation of Algorithms, Arrays, Spars...Unit I- Data structures Introduction, Evaluation of Algorithms, Arrays, Spars...
Unit I- Data structures Introduction, Evaluation of Algorithms, Arrays, Spars...
ย 
Data structure - Graph
Data structure - GraphData structure - Graph
Data structure - Graph
ย 
Stacks and Queue - Data Structures
Stacks and Queue - Data StructuresStacks and Queue - Data Structures
Stacks and Queue - Data Structures
ย 
Stack
StackStack
Stack
ย 
1.1 binary tree
1.1 binary tree1.1 binary tree
1.1 binary tree
ย 
Queues
QueuesQueues
Queues
ย 
Queue in Data Structure
Queue in Data Structure Queue in Data Structure
Queue in Data Structure
ย 
Applications of stack
Applications of stackApplications of stack
Applications of stack
ย 
linked list in Data Structure, Simple and Easy Tutorial
linked list in Data Structure, Simple and Easy Tutoriallinked list in Data Structure, Simple and Easy Tutorial
linked list in Data Structure, Simple and Easy Tutorial
ย 
Hash table
Hash tableHash table
Hash table
ย 

Similar to Stack_Data_Structure.pptx

STACKS IN DATASTRUCTURE
STACKS IN DATASTRUCTURESTACKS IN DATASTRUCTURE
STACKS IN DATASTRUCTURE
Archie Jamwal
ย 
Project on stack Data structure
Project on stack Data structureProject on stack Data structure
Project on stack Data structure
Soham Nanekar
ย 
Stack and Queue by M.Gomathi Lecturer
Stack and Queue by M.Gomathi LecturerStack and Queue by M.Gomathi Lecturer
Stack and Queue by M.Gomathi Lecturer
gomathi chlm
ย 
Stack & Queue
Stack & QueueStack & Queue
Stack & Queue
Hasan Mahadi Riaz
ย 
STACK AND QUEUE CIRCULAR QUEUE PPTS.pptx
STACK AND QUEUE CIRCULAR QUEUE PPTS.pptxSTACK AND QUEUE CIRCULAR QUEUE PPTS.pptx
STACK AND QUEUE CIRCULAR QUEUE PPTS.pptx
sunitha1792
ย 
STACK AND ITS OPERATIONS IN DATA STRUCTURES.pptx
STACK AND ITS OPERATIONS IN DATA STRUCTURES.pptxSTACK AND ITS OPERATIONS IN DATA STRUCTURES.pptx
STACK AND ITS OPERATIONS IN DATA STRUCTURES.pptx
KALPANAC20
ย 
Data Structures & Algorithms Unit 1.pptx
Data Structures & Algorithms Unit 1.pptxData Structures & Algorithms Unit 1.pptx
Data Structures & Algorithms Unit 1.pptx
UsriDevi1
ย 
STACK.pptx
STACK.pptxSTACK.pptx
STACK.pptx
Dr.Shweta
ย 
Stacks Data structure.pptx
Stacks Data structure.pptxStacks Data structure.pptx
Stacks Data structure.pptx
line24arts
ย 
data structure in programing language.ppt
data structure in programing language.pptdata structure in programing language.ppt
data structure in programing language.ppt
LavkushGupta12
ย 
DS-UNIT 3 FINAL.pptx
DS-UNIT 3 FINAL.pptxDS-UNIT 3 FINAL.pptx
DS-UNIT 3 FINAL.pptx
prakashvs7
ย 
Ds stack & queue
Ds   stack & queueDs   stack & queue
Ds stack & queue
Sunipa Bera
ย 
Stack in Sata Structure
Stack in Sata StructureStack in Sata Structure
Stack in Sata Structure
Muhazzab Chouhadry
ย 
stack.pptx
stack.pptxstack.pptx
stack.pptx
mayankKatiyar17
ย 
Stack_Overview_Implementation_WithVode.pptx
Stack_Overview_Implementation_WithVode.pptxStack_Overview_Implementation_WithVode.pptx
Stack_Overview_Implementation_WithVode.pptx
chandankumar364348
ย 
5.-Stacks.pptx
5.-Stacks.pptx5.-Stacks.pptx
5.-Stacks.pptx
iloveyoucarlo0923
ย 
Data Structure
Data Structure Data Structure
Data Structure
Ibrahim MH
ย 
Stacks in Python will be made using lists.pdf
Stacks in Python will be made using lists.pdfStacks in Python will be made using lists.pdf
Stacks in Python will be made using lists.pdf
DeeptiMalhotra19
ย 
Data Structures: Stacks (Part 1)
Data Structures: Stacks (Part 1)Data Structures: Stacks (Part 1)
Data Structures: Stacks (Part 1)
Ramachandra Adiga G
ย 
DATA STRUCTURE AND ALGORITJM POWERPOINT.ppt
DATA STRUCTURE AND ALGORITJM POWERPOINT.pptDATA STRUCTURE AND ALGORITJM POWERPOINT.ppt
DATA STRUCTURE AND ALGORITJM POWERPOINT.ppt
yarotos643
ย 

Similar to Stack_Data_Structure.pptx (20)

STACKS IN DATASTRUCTURE
STACKS IN DATASTRUCTURESTACKS IN DATASTRUCTURE
STACKS IN DATASTRUCTURE
ย 
Project on stack Data structure
Project on stack Data structureProject on stack Data structure
Project on stack Data structure
ย 
Stack and Queue by M.Gomathi Lecturer
Stack and Queue by M.Gomathi LecturerStack and Queue by M.Gomathi Lecturer
Stack and Queue by M.Gomathi Lecturer
ย 
Stack & Queue
Stack & QueueStack & Queue
Stack & Queue
ย 
STACK AND QUEUE CIRCULAR QUEUE PPTS.pptx
STACK AND QUEUE CIRCULAR QUEUE PPTS.pptxSTACK AND QUEUE CIRCULAR QUEUE PPTS.pptx
STACK AND QUEUE CIRCULAR QUEUE PPTS.pptx
ย 
STACK AND ITS OPERATIONS IN DATA STRUCTURES.pptx
STACK AND ITS OPERATIONS IN DATA STRUCTURES.pptxSTACK AND ITS OPERATIONS IN DATA STRUCTURES.pptx
STACK AND ITS OPERATIONS IN DATA STRUCTURES.pptx
ย 
Data Structures & Algorithms Unit 1.pptx
Data Structures & Algorithms Unit 1.pptxData Structures & Algorithms Unit 1.pptx
Data Structures & Algorithms Unit 1.pptx
ย 
STACK.pptx
STACK.pptxSTACK.pptx
STACK.pptx
ย 
Stacks Data structure.pptx
Stacks Data structure.pptxStacks Data structure.pptx
Stacks Data structure.pptx
ย 
data structure in programing language.ppt
data structure in programing language.pptdata structure in programing language.ppt
data structure in programing language.ppt
ย 
DS-UNIT 3 FINAL.pptx
DS-UNIT 3 FINAL.pptxDS-UNIT 3 FINAL.pptx
DS-UNIT 3 FINAL.pptx
ย 
Ds stack & queue
Ds   stack & queueDs   stack & queue
Ds stack & queue
ย 
Stack in Sata Structure
Stack in Sata StructureStack in Sata Structure
Stack in Sata Structure
ย 
stack.pptx
stack.pptxstack.pptx
stack.pptx
ย 
Stack_Overview_Implementation_WithVode.pptx
Stack_Overview_Implementation_WithVode.pptxStack_Overview_Implementation_WithVode.pptx
Stack_Overview_Implementation_WithVode.pptx
ย 
5.-Stacks.pptx
5.-Stacks.pptx5.-Stacks.pptx
5.-Stacks.pptx
ย 
Data Structure
Data Structure Data Structure
Data Structure
ย 
Stacks in Python will be made using lists.pdf
Stacks in Python will be made using lists.pdfStacks in Python will be made using lists.pdf
Stacks in Python will be made using lists.pdf
ย 
Data Structures: Stacks (Part 1)
Data Structures: Stacks (Part 1)Data Structures: Stacks (Part 1)
Data Structures: Stacks (Part 1)
ย 
DATA STRUCTURE AND ALGORITJM POWERPOINT.ppt
DATA STRUCTURE AND ALGORITJM POWERPOINT.pptDATA STRUCTURE AND ALGORITJM POWERPOINT.ppt
DATA STRUCTURE AND ALGORITJM POWERPOINT.ppt
ย 

More from sandeep54552

Dijkstra Searching Algorithms Shortest.pptx
Dijkstra Searching Algorithms Shortest.pptxDijkstra Searching Algorithms Shortest.pptx
Dijkstra Searching Algorithms Shortest.pptx
sandeep54552
ย 
E_R-Diagram (2).pptx
E_R-Diagram (2).pptxE_R-Diagram (2).pptx
E_R-Diagram (2).pptx
sandeep54552
ย 
Dijkstra Searching Algorithms.pptx
Dijkstra Searching Algorithms.pptxDijkstra Searching Algorithms.pptx
Dijkstra Searching Algorithms.pptx
sandeep54552
ย 
Agents_AI.ppt
Agents_AI.pptAgents_AI.ppt
Agents_AI.ppt
sandeep54552
ย 
Heap_Sort1.pptx
Heap_Sort1.pptxHeap_Sort1.pptx
Heap_Sort1.pptx
sandeep54552
ย 
Templates in c++
Templates in c++Templates in c++
Templates in c++
sandeep54552
ย 
File handling in c++
File handling in c++File handling in c++
File handling in c++
sandeep54552
ย 
Exception handling in c++
Exception handling in c++Exception handling in c++
Exception handling in c++
sandeep54552
ย 
Inheritance in c++
Inheritance in c++ Inheritance in c++
Inheritance in c++
sandeep54552
ย 
Constructor and Destructors in C++
Constructor and Destructors in C++Constructor and Destructors in C++
Constructor and Destructors in C++
sandeep54552
ย 
C++ programming introduction
C++ programming introductionC++ programming introduction
C++ programming introduction
sandeep54552
ย 
Jsp tag library
Jsp tag libraryJsp tag library
Jsp tag library
sandeep54552
ย 
Hill climbing algorithm in artificial intelligence
Hill climbing algorithm in artificial intelligenceHill climbing algorithm in artificial intelligence
Hill climbing algorithm in artificial intelligence
sandeep54552
ย 
Session bean
Session beanSession bean
Session bean
sandeep54552
ย 
Greedy algorithms
Greedy algorithmsGreedy algorithms
Greedy algorithms
sandeep54552
ย 
A star algorithms
A star algorithmsA star algorithms
A star algorithms
sandeep54552
ย 
Bfs new
Bfs newBfs new
Bfs new
sandeep54552
ย 
Bfs new
Bfs newBfs new
Bfs new
sandeep54552
ย 
Jdbc ppt
Jdbc pptJdbc ppt
Jdbc ppt
sandeep54552
ย 
Enterprise java unit-3_chapter-1-jsp
Enterprise  java unit-3_chapter-1-jspEnterprise  java unit-3_chapter-1-jsp
Enterprise java unit-3_chapter-1-jsp
sandeep54552
ย 

More from sandeep54552 (20)

Dijkstra Searching Algorithms Shortest.pptx
Dijkstra Searching Algorithms Shortest.pptxDijkstra Searching Algorithms Shortest.pptx
Dijkstra Searching Algorithms Shortest.pptx
ย 
E_R-Diagram (2).pptx
E_R-Diagram (2).pptxE_R-Diagram (2).pptx
E_R-Diagram (2).pptx
ย 
Dijkstra Searching Algorithms.pptx
Dijkstra Searching Algorithms.pptxDijkstra Searching Algorithms.pptx
Dijkstra Searching Algorithms.pptx
ย 
Agents_AI.ppt
Agents_AI.pptAgents_AI.ppt
Agents_AI.ppt
ย 
Heap_Sort1.pptx
Heap_Sort1.pptxHeap_Sort1.pptx
Heap_Sort1.pptx
ย 
Templates in c++
Templates in c++Templates in c++
Templates in c++
ย 
File handling in c++
File handling in c++File handling in c++
File handling in c++
ย 
Exception handling in c++
Exception handling in c++Exception handling in c++
Exception handling in c++
ย 
Inheritance in c++
Inheritance in c++ Inheritance in c++
Inheritance in c++
ย 
Constructor and Destructors in C++
Constructor and Destructors in C++Constructor and Destructors in C++
Constructor and Destructors in C++
ย 
C++ programming introduction
C++ programming introductionC++ programming introduction
C++ programming introduction
ย 
Jsp tag library
Jsp tag libraryJsp tag library
Jsp tag library
ย 
Hill climbing algorithm in artificial intelligence
Hill climbing algorithm in artificial intelligenceHill climbing algorithm in artificial intelligence
Hill climbing algorithm in artificial intelligence
ย 
Session bean
Session beanSession bean
Session bean
ย 
Greedy algorithms
Greedy algorithmsGreedy algorithms
Greedy algorithms
ย 
A star algorithms
A star algorithmsA star algorithms
A star algorithms
ย 
Bfs new
Bfs newBfs new
Bfs new
ย 
Bfs new
Bfs newBfs new
Bfs new
ย 
Jdbc ppt
Jdbc pptJdbc ppt
Jdbc ppt
ย 
Enterprise java unit-3_chapter-1-jsp
Enterprise  java unit-3_chapter-1-jspEnterprise  java unit-3_chapter-1-jsp
Enterprise java unit-3_chapter-1-jsp
ย 

Recently uploaded

Your Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective UpskillingYour Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective Upskilling
Excellence Foundation for South Sudan
ย 
clinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdfclinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdf
Priyankaranawat4
ย 
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
GeorgeMilliken2
ย 
Walmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdfWalmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdf
TechSoup
ย 
Prรฉsentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Prรฉsentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptxPrรฉsentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Prรฉsentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
siemaillard
ย 
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) CurriculumPhilippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
MJDuyan
ย 
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdfANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
Priyankaranawat4
ย 
The History of Stoke Newington Street Names
The History of Stoke Newington Street NamesThe History of Stoke Newington Street Names
The History of Stoke Newington Street Names
History of Stoke Newington
ย 
Leveraging Generative AI to Drive Nonprofit Innovation
Leveraging Generative AI to Drive Nonprofit InnovationLeveraging Generative AI to Drive Nonprofit Innovation
Leveraging Generative AI to Drive Nonprofit Innovation
TechSoup
ย 
Solutons Maths Escape Room Spatial .pptx
Solutons Maths Escape Room Spatial .pptxSolutons Maths Escape Room Spatial .pptx
Solutons Maths Escape Room Spatial .pptx
spdendr
ย 
ZK on Polkadot zero knowledge proofs - sub0.pptx
ZK on Polkadot zero knowledge proofs - sub0.pptxZK on Polkadot zero knowledge proofs - sub0.pptx
ZK on Polkadot zero knowledge proofs - sub0.pptx
dot55audits
ย 
Liberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdfLiberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdf
WaniBasim
ย 
Bร€I TแบฌP Dแบ Y THรŠM TIแบพNG ANH LแปšP 7 Cแบข Nฤ‚M FRIENDS PLUS SรCH CHร‚N TRแปœI SรNG Tแบ O ...
Bร€I TแบฌP Dแบ Y THรŠM TIแบพNG ANH LแปšP 7 Cแบข Nฤ‚M FRIENDS PLUS SรCH CHร‚N TRแปœI SรNG Tแบ O ...Bร€I TแบฌP Dแบ Y THรŠM TIแบพNG ANH LแปšP 7 Cแบข Nฤ‚M FRIENDS PLUS SรCH CHร‚N TRแปœI SรNG Tแบ O ...
Bร€I TแบฌP Dแบ Y THรŠM TIแบพNG ANH LแปšP 7 Cแบข Nฤ‚M FRIENDS PLUS SรCH CHร‚N TRแปœI SรNG Tแบ O ...
Nguyen Thanh Tu Collection
ย 
BBR 2024 Summer Sessions Interview Training
BBR  2024 Summer Sessions Interview TrainingBBR  2024 Summer Sessions Interview Training
BBR 2024 Summer Sessions Interview Training
Katrina Pritchard
ย 
Constructing Your Course Container for Effective Communication
Constructing Your Course Container for Effective CommunicationConstructing Your Course Container for Effective Communication
Constructing Your Course Container for Effective Communication
Chevonnese Chevers Whyte, MBA, B.Sc.
ย 
Bed Making ( Introduction, Purpose, Types, Articles, Scientific principles, N...
Bed Making ( Introduction, Purpose, Types, Articles, Scientific principles, N...Bed Making ( Introduction, Purpose, Types, Articles, Scientific principles, N...
Bed Making ( Introduction, Purpose, Types, Articles, Scientific principles, N...
Leena Ghag-Sakpal
ย 
Chapter wise All Notes of First year Basic Civil Engineering.pptx
Chapter wise All Notes of First year Basic Civil Engineering.pptxChapter wise All Notes of First year Basic Civil Engineering.pptx
Chapter wise All Notes of First year Basic Civil Engineering.pptx
Denish Jangid
ย 
writing about opinions about Australia the movie
writing about opinions about Australia the moviewriting about opinions about Australia the movie
writing about opinions about Australia the movie
Nicholas Montgomery
ย 
MARY JANE WILSON, A โ€œBOA MรƒEโ€ .
MARY JANE WILSON, A โ€œBOA MรƒEโ€           .MARY JANE WILSON, A โ€œBOA MรƒEโ€           .
MARY JANE WILSON, A โ€œBOA MรƒEโ€ .
Colรฉgio Santa Teresinha
ย 
spot a liar (Haiqa 146).pptx Technical writhing and presentation skills
spot a liar (Haiqa 146).pptx Technical writhing and presentation skillsspot a liar (Haiqa 146).pptx Technical writhing and presentation skills
spot a liar (Haiqa 146).pptx Technical writhing and presentation skills
haiqairshad
ย 

Recently uploaded (20)

Your Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective UpskillingYour Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective Upskilling
ย 
clinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdfclinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdf
ย 
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
ย 
Walmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdfWalmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdf
ย 
Prรฉsentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Prรฉsentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptxPrรฉsentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Prรฉsentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
ย 
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) CurriculumPhilippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
ย 
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdfANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ย 
The History of Stoke Newington Street Names
The History of Stoke Newington Street NamesThe History of Stoke Newington Street Names
The History of Stoke Newington Street Names
ย 
Leveraging Generative AI to Drive Nonprofit Innovation
Leveraging Generative AI to Drive Nonprofit InnovationLeveraging Generative AI to Drive Nonprofit Innovation
Leveraging Generative AI to Drive Nonprofit Innovation
ย 
Solutons Maths Escape Room Spatial .pptx
Solutons Maths Escape Room Spatial .pptxSolutons Maths Escape Room Spatial .pptx
Solutons Maths Escape Room Spatial .pptx
ย 
ZK on Polkadot zero knowledge proofs - sub0.pptx
ZK on Polkadot zero knowledge proofs - sub0.pptxZK on Polkadot zero knowledge proofs - sub0.pptx
ZK on Polkadot zero knowledge proofs - sub0.pptx
ย 
Liberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdfLiberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdf
ย 
Bร€I TแบฌP Dแบ Y THรŠM TIแบพNG ANH LแปšP 7 Cแบข Nฤ‚M FRIENDS PLUS SรCH CHร‚N TRแปœI SรNG Tแบ O ...
Bร€I TแบฌP Dแบ Y THรŠM TIแบพNG ANH LแปšP 7 Cแบข Nฤ‚M FRIENDS PLUS SรCH CHร‚N TRแปœI SรNG Tแบ O ...Bร€I TแบฌP Dแบ Y THรŠM TIแบพNG ANH LแปšP 7 Cแบข Nฤ‚M FRIENDS PLUS SรCH CHร‚N TRแปœI SรNG Tแบ O ...
Bร€I TแบฌP Dแบ Y THรŠM TIแบพNG ANH LแปšP 7 Cแบข Nฤ‚M FRIENDS PLUS SรCH CHร‚N TRแปœI SรNG Tแบ O ...
ย 
BBR 2024 Summer Sessions Interview Training
BBR  2024 Summer Sessions Interview TrainingBBR  2024 Summer Sessions Interview Training
BBR 2024 Summer Sessions Interview Training
ย 
Constructing Your Course Container for Effective Communication
Constructing Your Course Container for Effective CommunicationConstructing Your Course Container for Effective Communication
Constructing Your Course Container for Effective Communication
ย 
Bed Making ( Introduction, Purpose, Types, Articles, Scientific principles, N...
Bed Making ( Introduction, Purpose, Types, Articles, Scientific principles, N...Bed Making ( Introduction, Purpose, Types, Articles, Scientific principles, N...
Bed Making ( Introduction, Purpose, Types, Articles, Scientific principles, N...
ย 
Chapter wise All Notes of First year Basic Civil Engineering.pptx
Chapter wise All Notes of First year Basic Civil Engineering.pptxChapter wise All Notes of First year Basic Civil Engineering.pptx
Chapter wise All Notes of First year Basic Civil Engineering.pptx
ย 
writing about opinions about Australia the movie
writing about opinions about Australia the moviewriting about opinions about Australia the movie
writing about opinions about Australia the movie
ย 
MARY JANE WILSON, A โ€œBOA MรƒEโ€ .
MARY JANE WILSON, A โ€œBOA MรƒEโ€           .MARY JANE WILSON, A โ€œBOA MรƒEโ€           .
MARY JANE WILSON, A โ€œBOA MรƒEโ€ .
ย 
spot a liar (Haiqa 146).pptx Technical writhing and presentation skills
spot a liar (Haiqa 146).pptx Technical writhing and presentation skillsspot a liar (Haiqa 146).pptx Technical writhing and presentation skills
spot a liar (Haiqa 146).pptx Technical writhing and presentation skills
ย 

Stack_Data_Structure.pptx

  • 2. DATA STRUCTURE LINEAR DATA STRUCTURE ARRAY QUEUE STACK NON LINEAR DATA STRUCTURE
  • 3. What is Linear Data Structure ๏ƒ˜In linear data structure, data is arranged in linear sequence. ๏ƒ˜ Data items can be traversed in a single run. ๏ƒ˜ In linear data structure elements are accessed or placed in contiguous(together in sequence) memory location.
  • 4. WHAT Is ๏ƒ˜ A stack is called a last-in-first-out (LIFO) collection. This means that the last thing we added (pushed) is the first thing that gets pulled (popped) off. A stack is a sequence of items that are accessible at only one end of the sequence.
  • 5. Definition of Stack: Stacks in Data Structures is a linear type of data structure that follows the LIFO (Last-In-First-Out) principle and allows insertion and deletion operations from one end of the stack data structure, that is top. If any Element inserted then Top will be increased by 1 & if any Element deleted then Top will be decreased by 1. Top=Top+1 (Insertion) Top=Top-1 (Deletion)
  • 7. Operations that can be performed on STACK: ๏ƒ˜ PUSH. ๏ƒ˜ POP.
  • 8. PUSH : It is used to insert items into the stack. POP: It is used to delete items from stack. TOP: It represents the current location of data in stack.
  • 9. ALGORITHM OF INSERTION IN STACK: (PUSH) 1. Insertion(a,top,item,max) 2. If top=max then print โ€˜STACK OVERFLOWโ€™ exit else 3. top=top+1 end if 4. a[top]=item 5. Exit
  • 10. ALGORITHM OF DELETION IN STACK: (POP) 1. Deletion(a,top,item) 2. If top=0 then print โ€˜STACK UNDERFLOWโ€™ exit else 3. item=a[top] end if 4 . top=top-1 5. Exit
  • 11. ALGORITHM OF DISPLAY IN STACK: 1.Display(top,i,a[i]) 2.If top=0 then Print โ€˜STACK EMPTYโ€™ Exit Else 3.For i=top to 0 Print a[i] End for 4.exit
  • 12. APPLICATIONS OF STACKS ARE: I. Reversing Strings: โ€ข A simple application of stack is reversing strings. To reverse a string , the characters of string are pushed onto the stack one by one as the string is read from left to right. โ€ข Once all the characters of string are pushed onto stack, they are popped one by one. Since the character last pushed in comes out first, subsequent pop operation results in the reversal of the string.
  • 13. For example: To reverse the string โ€˜REVERSEโ€™ the string is read from left to right and its characters are pushed . LIKE: onto a stack.
  • 14. II. Checking the validity of an expression containing nested parenthesis: โ€ข Stacks are also used to check whether a given arithmetic expressions containing nested parenthesis is properly parenthesized. โ€ข The program for checking the validity of an expression verifies that for each left parenthesis braces or bracket ,there is a corresponding closing symbol and symbols are appropriately nested.
  • 15. For example: VALID INPUTS INVALID INPUTS { } { ( } ( { [ ] } ) ( [ ( ( ) ] ) { [ ] ( ) } { } [ ] ) [ { ( { } [ ] ( { [ { ) } ( ] } ] })}]
  • 16. III. Evaluating arithmetic expressions: INFIX notation: The general way of writing arithmetic expressions is known as infix notation. e.g, (a+b) PREFIX notation: e.g, +AB POSTFIX notation: e.g: AB+
  • 17. Conversion of INFIX to POSTFIX conversion: Example: 2+(4-1)*3 2+41-*3 2+41-3* 241-3*+ step1 step2 step3 step4
  • 18. CURREN T SYMBOL ACTION PERFORME D STACK STATUS POSTFIX EXPRESSIO N ( PUSH C C 2 2 2 + PUSH + (+ 2 ( PUSH ( (+( 24 4 24 - PUSH - (+(- 241 1 POP 241- ) (+ 241- * PUSH * (+* 241- 3 241-3 POP * 241-3* POP + 241-3*+ CONVERSION OF INFIX INTO POSTFIX 2+(4-1)*3 into 241-3*+