SlideShare a Scribd company logo
STACKS
 INTRODUCTION
 HISTORY
 STACK
 PUSH , POP
 APPLICATION OF STACK
CONTENTS
A Stack is data structure in which
addition of new element or deletion of
existing element always takes place at a
same end. This end is known as the top of
the stack. That means that it is possible
to remove elements from a stack in
reverse order from the insertion of
elements into the stack.
INTRODUCTION
Stacks entered the computer science
literature in 1946, in the computer design
of Alan M. Turing (who used the terms
"bury" and "unbury") as a means of calling
and returning from subroutines Subroutine
had already been implemented in
KonradZuse in 1945. Klaus Samelso and
Friedrich L. Bauer of Technical University
Munich proposed the idea in 1955 and filed
a patent in 1957. The same concept was
developed, independently, by the Australian
Charles Leonard Hamblin in the first half of
1957.
HISTORY
Defination : Stack is a non primative and linear
data structure.
Operation of stack:
i)Insertion[PUSH( )] .
ii)Deletion [POP ( )].
iii)Top ( ).
iv)Empty( ).
v)Is Full( ).
STACK
It is a function that is used to insert items
into stack.
In PUSH there is a overflow of items in Stack.
If top =max then print STACK OVERFLOW
PUSH
It is a function used to delete items from
stack.
In POP there is underflow of items in stack.
If top=0 then print stack underflow.
POP
 REVERSING A LIST.
 POLISH NOTATION
 CONVERSION OF INFIX TO POSTFIX
EXPRESSION
 EVALUTION OF POSTFIX EXPRESSION
 CONVERSION OF INFIX TO PREFIX
EXPRESSION
 EVALUTION OF PREFIX EXPRESSION
 RECURSION
APPLICATION OF
STACK
It is the method of writing operation of
an expression neither before there
operants or after them is called polish
notation.
There are 3 types of polish notation:
i)Infix notation eg : A+B
ii)Prefix notation eg : +AB
iii)Postfix notation eg : AB+
POLISH
NOTATION
1) The order in which the operators appear is
not reversed.
2) When the '+' is read, it has lower
precedence than the '*', so the '*' must be
printed first.
3) We will show this in a table with three
columns. The first will show the symbol
currently being read.
4) The second will show what is on the stack
and the third will show the current contents
ALGORITHM :
INFIX TO POSTFIX
CONVERSION
CONVERSION OF INFIX TO
POSTFIX EXPRESSION
EXPRESSION : 1,2,3,*,+,4,-
FINAL ANSWER IS 3.
EVALUTION OF POSTFIX
EXPRESSION
1) Push “)” onto STACK, and add “(“ to end of
the A.
2) Scan A from right to left and repeat step 3
to 6 for each element of A until
the STACK is empty.
3) If an operand is encountered add it to B.
4) If a right parenthesis is encountered push
it onto STACK
ALGORITHM :
INFIX TO PREFIX
EXPRESSION
CONVERSION OF INFIX TO PREFIX
EXPRESSION
EXPRESSION : +,-,2,7,*,8,/,4,12
FINAL ANSWER IS 29
EVALUTION OF PREFIX
EXPRESSION
Recursion is an approach in which a
function calls itself with an argument.
Upon reaching a termination condition,
the control returns to the calling
function.
RECURSION

More Related Content

PDF
Lo18
PPTX
Data structures
PPT
An adaptive algorithm for detection of duplicate records
PDF
Cyclcone a safe dialect of C
DOC
PDF
Data Visualization With R: Learn To Modify Font Of Graphical Parameters
DOC
PDF
R Data Visualization: Learn To Add Text Annotations To Plots
Lo18
Data structures
An adaptive algorithm for detection of duplicate records
Cyclcone a safe dialect of C
Data Visualization With R: Learn To Modify Font Of Graphical Parameters
R Data Visualization: Learn To Add Text Annotations To Plots

What's hot (20)

PDF
Cad for vlsi design june2013 (2)
PDF
Queue in C, Queue Real Life of Example
PPTX
Pointers
PPT
Headerfiles
PDF
Write declarations for each of the following variables: a. amounts is a...
PDF
Data Visualization With R: Introduction
PDF
Intro to Functional Programming
PPTX
Exercise6 ch2
DOCX
Cs6503 theory of computation november december 2016
PDF
Cs6503 theory of computation may june 2016 be cse anna university question paper
PDF
Cs2303 theory of computation november december 2015
PDF
Applications of stack
PPTX
Ternary operator
PDF
Data Visualization With R: Learn To Modify Color Of Plots
PDF
Cs6503 theory of computation november december 2015 be cse anna university q...
PDF
Foundation of computing history final
PDF
R Data Visualization Tutorial: Bar Plots
PPT
Application of Stacks
PDF
20181204i mlse discussions
Cad for vlsi design june2013 (2)
Queue in C, Queue Real Life of Example
Pointers
Headerfiles
Write declarations for each of the following variables: a. amounts is a...
Data Visualization With R: Introduction
Intro to Functional Programming
Exercise6 ch2
Cs6503 theory of computation november december 2016
Cs6503 theory of computation may june 2016 be cse anna university question paper
Cs2303 theory of computation november december 2015
Applications of stack
Ternary operator
Data Visualization With R: Learn To Modify Color Of Plots
Cs6503 theory of computation november december 2015 be cse anna university q...
Foundation of computing history final
R Data Visualization Tutorial: Bar Plots
Application of Stacks
20181204i mlse discussions
Ad

Similar to Stacks (20)

PPTX
STACKS IN DATASTRUCTURE
PPTX
CH4.pptx
PDF
Data Structures And Algorithms(stacks queues)
PPTX
dsppt-141121224848-conversion01 (1).pptx
PPTX
Stacks Data structure.pptx
PPTX
stack & queue
PPTX
Data structure Stack
PPTX
Unit 3 stack
PPT
PDF
5 chapter3 list_stackqueuepart2
PPTX
Data structure day3
PPTX
5.-Stacks.pptx
PPTX
Stack_Overview_Implementation_WithVode.pptx
PPTX
Stacks in c++
PPT
stack.ppt
PDF
PPTX
Prefix and PostFIx presentation for DSA .pptx
PPTX
13 Stacks and Queues.pptx
PPTX
STACK1.pptx
PPTX
PPT Lecture 3.2.1 stack newxxxxxxxxxx.pptx
STACKS IN DATASTRUCTURE
CH4.pptx
Data Structures And Algorithms(stacks queues)
dsppt-141121224848-conversion01 (1).pptx
Stacks Data structure.pptx
stack & queue
Data structure Stack
Unit 3 stack
5 chapter3 list_stackqueuepart2
Data structure day3
5.-Stacks.pptx
Stack_Overview_Implementation_WithVode.pptx
Stacks in c++
stack.ppt
Prefix and PostFIx presentation for DSA .pptx
13 Stacks and Queues.pptx
STACK1.pptx
PPT Lecture 3.2.1 stack newxxxxxxxxxx.pptx
Ad

Recently uploaded (20)

PPTX
Construction Project Organization Group 2.pptx
PDF
composite construction of structures.pdf
PPTX
CYBER-CRIMES AND SECURITY A guide to understanding
PPTX
Welding lecture in detail for understanding
PPTX
MCN 401 KTU-2019-PPE KITS-MODULE 2.pptx
PPTX
KTU 2019 -S7-MCN 401 MODULE 2-VINAY.pptx
PDF
Arduino robotics embedded978-1-4302-3184-4.pdf
PPTX
OOP with Java - Java Introduction (Basics)
PDF
PRIZ Academy - 9 Windows Thinking Where to Invest Today to Win Tomorrow.pdf
PPTX
bas. eng. economics group 4 presentation 1.pptx
PPTX
MET 305 2019 SCHEME MODULE 2 COMPLETE.pptx
PDF
Structs to JSON How Go Powers REST APIs.pdf
PPTX
Sustainable Sites - Green Building Construction
PPTX
Lesson 3_Tessellation.pptx finite Mathematics
PDF
Embodied AI: Ushering in the Next Era of Intelligent Systems
PPTX
Engineering Ethics, Safety and Environment [Autosaved] (1).pptx
PPTX
Recipes for Real Time Voice AI WebRTC, SLMs and Open Source Software.pptx
PPTX
UNIT-1 - COAL BASED THERMAL POWER PLANTS
DOCX
573137875-Attendance-Management-System-original
PDF
July 2025 - Top 10 Read Articles in International Journal of Software Enginee...
Construction Project Organization Group 2.pptx
composite construction of structures.pdf
CYBER-CRIMES AND SECURITY A guide to understanding
Welding lecture in detail for understanding
MCN 401 KTU-2019-PPE KITS-MODULE 2.pptx
KTU 2019 -S7-MCN 401 MODULE 2-VINAY.pptx
Arduino robotics embedded978-1-4302-3184-4.pdf
OOP with Java - Java Introduction (Basics)
PRIZ Academy - 9 Windows Thinking Where to Invest Today to Win Tomorrow.pdf
bas. eng. economics group 4 presentation 1.pptx
MET 305 2019 SCHEME MODULE 2 COMPLETE.pptx
Structs to JSON How Go Powers REST APIs.pdf
Sustainable Sites - Green Building Construction
Lesson 3_Tessellation.pptx finite Mathematics
Embodied AI: Ushering in the Next Era of Intelligent Systems
Engineering Ethics, Safety and Environment [Autosaved] (1).pptx
Recipes for Real Time Voice AI WebRTC, SLMs and Open Source Software.pptx
UNIT-1 - COAL BASED THERMAL POWER PLANTS
573137875-Attendance-Management-System-original
July 2025 - Top 10 Read Articles in International Journal of Software Enginee...

Stacks

  • 2.  INTRODUCTION  HISTORY  STACK  PUSH , POP  APPLICATION OF STACK CONTENTS
  • 3. A Stack is data structure in which addition of new element or deletion of existing element always takes place at a same end. This end is known as the top of the stack. That means that it is possible to remove elements from a stack in reverse order from the insertion of elements into the stack. INTRODUCTION
  • 4. Stacks entered the computer science literature in 1946, in the computer design of Alan M. Turing (who used the terms "bury" and "unbury") as a means of calling and returning from subroutines Subroutine had already been implemented in KonradZuse in 1945. Klaus Samelso and Friedrich L. Bauer of Technical University Munich proposed the idea in 1955 and filed a patent in 1957. The same concept was developed, independently, by the Australian Charles Leonard Hamblin in the first half of 1957. HISTORY
  • 5. Defination : Stack is a non primative and linear data structure. Operation of stack: i)Insertion[PUSH( )] . ii)Deletion [POP ( )]. iii)Top ( ). iv)Empty( ). v)Is Full( ). STACK
  • 6. It is a function that is used to insert items into stack. In PUSH there is a overflow of items in Stack. If top =max then print STACK OVERFLOW PUSH
  • 7. It is a function used to delete items from stack. In POP there is underflow of items in stack. If top=0 then print stack underflow. POP
  • 8.  REVERSING A LIST.  POLISH NOTATION  CONVERSION OF INFIX TO POSTFIX EXPRESSION  EVALUTION OF POSTFIX EXPRESSION  CONVERSION OF INFIX TO PREFIX EXPRESSION  EVALUTION OF PREFIX EXPRESSION  RECURSION APPLICATION OF STACK
  • 9. It is the method of writing operation of an expression neither before there operants or after them is called polish notation. There are 3 types of polish notation: i)Infix notation eg : A+B ii)Prefix notation eg : +AB iii)Postfix notation eg : AB+ POLISH NOTATION
  • 10. 1) The order in which the operators appear is not reversed. 2) When the '+' is read, it has lower precedence than the '*', so the '*' must be printed first. 3) We will show this in a table with three columns. The first will show the symbol currently being read. 4) The second will show what is on the stack and the third will show the current contents ALGORITHM : INFIX TO POSTFIX CONVERSION
  • 11. CONVERSION OF INFIX TO POSTFIX EXPRESSION
  • 12. EXPRESSION : 1,2,3,*,+,4,- FINAL ANSWER IS 3. EVALUTION OF POSTFIX EXPRESSION
  • 13. 1) Push “)” onto STACK, and add “(“ to end of the A. 2) Scan A from right to left and repeat step 3 to 6 for each element of A until the STACK is empty. 3) If an operand is encountered add it to B. 4) If a right parenthesis is encountered push it onto STACK ALGORITHM : INFIX TO PREFIX EXPRESSION
  • 14. CONVERSION OF INFIX TO PREFIX EXPRESSION
  • 15. EXPRESSION : +,-,2,7,*,8,/,4,12 FINAL ANSWER IS 29 EVALUTION OF PREFIX EXPRESSION
  • 16. Recursion is an approach in which a function calls itself with an argument. Upon reaching a termination condition, the control returns to the calling function. RECURSION