SlideShare ist ein Scribd-Unternehmen logo
1 von 16
Downloaden Sie, um offline zu lesen
A
Data Structure
   What is a Stack

   Stack Operations

   LIFO Stack

   Animation Depicting Push Operation

   Animation Depicting Pop Operation

   Array Implementation of Stack

   Applications of stack
        Checking for balanced braces
        Converting Infix Expression to Postfix
        Postfix calculator
What is a Stack?
A  stack is a Last In, First Out (LIFO) data
structure,objects inserted last are the first to
come out of the stack


Anything  added to the stack goes on the “top”
of the stack


Anything  removed from the stack is taken from
the “top” of the stack


Things  are removed in the reverse order from
that in which they were inserted
Stack Operations
   PUSH
     Adds the object to the top of the stack

   POP
     Removes the object at the top of the stack
      and returns it

   PEEK
      Returns the top object of the stack but does
      not remove it from the stack

   ISEMPTY
      Returns True if Stack is empty
A LIFO Stack
                Push            Pop




Stack Pointer           Top




                       Bottom
Stack
Stack
array Implementation of Stack
                         A[1] A[2] ….         ….    ….    A[n]


Push X                    w   y       x



            Stack pointer         Stack pointer       After many   Stack pointer
                 J=2                   J=3            Push Ops          J=n
             Before Push           After Push                        Stack Full




Pop                       w   y

After many Pop ops

         Stack Pointer        Stack Pointer        Stack Pointer
             J=0                   J=2                 J=3
         Stack Empty            After Pop           Before Pop
Checking for Balanced Braces

   ([]({()}[()])) is balanced; ([]({()}[())]) is not
   Simple counting is not enough to check
    balance
   You can do it with a stack: going left to
    right,
      If you see a (, [, or {, push it on the
        stack
      If you see a ), ], or }, pop the stack
        and check whether you got the
        corresponding (, [, or {
      When you reach the end, check that the
        stack is empty
Stack
Converting Infix Expressions to Equivalent
               Postfix Expressions
   Infix Expression         a+b

   Postfix Expression       ab+

   An infix expression can be evaluated by first
    being converted into an equivalent postfix
    expression

   Facts about converting from infix to postfix
     Operands always stay in the same order with
      respect to one another
     All parentheses are removed
Algorithm : Converting Infix Expression to
               Postfix using stack

  Suppose X is an arithmetic expression written in infix notation.
  This algorithm finds the equivalent postfix expression Y.

   1. Push "(" onto STACK, and add ")" to the end of X.
   2. Scan X from left to right and REPEAT Steps 3 to 6 for each element of X UNTIL the
       STACK is empty :
   3. If an operand is encountered, add it to Y.
   4. If a left parenthesis is encountered, push it onto STACK.
   5. If an operator is encountered, then :
   (a) Repeatedly pop from STACK and add to Y each operator (on the top of STACK) which has
   the same precedence as or higher precedence than operator.
   (b) Add operator to STACK.
   /* End of If structure * /
   6. If a right parenthesis is encountered, then :
   (a) Repeatedly pop from STACK and add to Y each operator (on the top of STACK)
   until a left parenthesis is encountered.
   (b) Remove the left parenthesis. [Do not add the left parenthesis to Y].
   /* End of If structure * /
   /* End of Step 2 loop * /
   7. END.
A trace of the algorithm that converts the infix expression
             a - (b + c * d)/e to postfix form
A postfix calculator
   When an operand is entered, the calculator
     Pushes it onto a stack



   When an operator is entered, the calculator
     Applies it to the top (one or two, depending
      on unary or binary operator) operand(s) of
      the stack

       Pops the operands from the stack

       Pushes the result of the operation on the
        stack
The action of a postfix calculator when evaluating the expression 2 * (3 + 4)
                        Postfix Notation--- 2 3 4 + *
Acknowledgement

   Data Structures BY Tanenbaum
   Internet
   Computer Science C++ A textbook for class XII        -By
    Sumita Arora




                         prepared by-
                            Seema kaushik,
                    Computer science department,
                 DAV public school, sector-14, gurgaon

Weitere ähnliche Inhalte

Was ist angesagt? (20)

Data structure by Digvijay
Data structure by DigvijayData structure by Digvijay
Data structure by Digvijay
 
Queue data structure
Queue data structureQueue data structure
Queue data structure
 
Infix to postfix conversion
Infix to postfix conversionInfix to postfix conversion
Infix to postfix conversion
 
Queue ppt
Queue pptQueue ppt
Queue ppt
 
Linked list
Linked listLinked list
Linked list
 
Deque and its applications
Deque and its applicationsDeque and its applications
Deque and its applications
 
Introduction to stack
Introduction to stackIntroduction to stack
Introduction to stack
 
stack presentation
stack presentationstack presentation
stack presentation
 
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
 
Introduction to data structure
Introduction to data structure Introduction to data structure
Introduction to data structure
 
Stacks IN DATA STRUCTURES
Stacks IN DATA STRUCTURESStacks IN DATA STRUCTURES
Stacks IN DATA STRUCTURES
 
Queue Data Structure
Queue Data StructureQueue Data Structure
Queue Data Structure
 
single linked list
single linked listsingle linked list
single linked list
 
Stack - Operations and Applications
Stack - Operations and ApplicationsStack - Operations and Applications
Stack - Operations and Applications
 
Stacks
StacksStacks
Stacks
 
Doubly Linked List
Doubly Linked ListDoubly Linked List
Doubly Linked List
 
Stack of Data structure
Stack of Data structureStack of Data structure
Stack of Data structure
 
Data Structure (Stack)
Data Structure (Stack)Data Structure (Stack)
Data Structure (Stack)
 
Insertion in singly linked list
Insertion in singly linked listInsertion in singly linked list
Insertion in singly linked list
 
Infix to Postfix Conversion Using Stack
Infix to Postfix Conversion Using StackInfix to Postfix Conversion Using Stack
Infix to Postfix Conversion Using Stack
 

Andere mochten auch

Stacks Implementation and Examples
Stacks Implementation and ExamplesStacks Implementation and Examples
Stacks Implementation and Examplesgreatqadirgee4u
 
Virtual base class
Virtual base classVirtual base class
Virtual base classTech_MX
 
Stack data structure
Stack data structureStack data structure
Stack data structureTech_MX
 
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
 
Permutation & Combination
Permutation & CombinationPermutation & Combination
Permutation & CombinationPuru Agrawal
 
Permutations and combinations examples
Permutations and combinations examplesPermutations and combinations examples
Permutations and combinations examplesLeo Crisologo
 
Permutation and combination
Permutation and combinationPermutation and combination
Permutation and combinationSadia Zareen
 
Permutations & Combinations
Permutations & CombinationsPermutations & Combinations
Permutations & Combinationsrfant
 

Andere mochten auch (9)

16 combinatroics-2
16 combinatroics-216 combinatroics-2
16 combinatroics-2
 
Stacks Implementation and Examples
Stacks Implementation and ExamplesStacks Implementation and Examples
Stacks Implementation and Examples
 
Virtual base class
Virtual base classVirtual base class
Virtual base class
 
Stack data structure
Stack data structureStack data structure
Stack data structure
 
Stack Data Structure & It's Application
Stack Data Structure & It's Application Stack Data Structure & It's Application
Stack Data Structure & It's Application
 
Permutation & Combination
Permutation & CombinationPermutation & Combination
Permutation & Combination
 
Permutations and combinations examples
Permutations and combinations examplesPermutations and combinations examples
Permutations and combinations examples
 
Permutation and combination
Permutation and combinationPermutation and combination
Permutation and combination
 
Permutations & Combinations
Permutations & CombinationsPermutations & Combinations
Permutations & Combinations
 

Ähnlich wie Stack

stack-111104232459-phpapp02.pdf
stack-111104232459-phpapp02.pdfstack-111104232459-phpapp02.pdf
stack-111104232459-phpapp02.pdfKalpana Mohan
 
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.pptxKALPANAC20
 
Data structure lab manual
Data structure lab manualData structure lab manual
Data structure lab manualnikshaikh786
 
Stack linked list
Stack linked listStack linked list
Stack linked listbhargav0077
 
Infix-Postfix expression conversion
Infix-Postfix expression conversionInfix-Postfix expression conversion
Infix-Postfix expression conversionRashmiranja625
 
Data Structures: Stacks (Part 1)
Data Structures: Stacks (Part 1)Data Structures: Stacks (Part 1)
Data Structures: Stacks (Part 1)Ramachandra Adiga G
 
Lec5-Stack-bukc-28022024-112316am (1) .pptx
Lec5-Stack-bukc-28022024-112316am (1) .pptxLec5-Stack-bukc-28022024-112316am (1) .pptx
Lec5-Stack-bukc-28022024-112316am (1) .pptxhaaamin01
 
Stacks,queues,linked-list
Stacks,queues,linked-listStacks,queues,linked-list
Stacks,queues,linked-listpinakspatel
 
The concept of stack is extremely important in computer science and .pdf
The concept of stack is extremely important in computer science and .pdfThe concept of stack is extremely important in computer science and .pdf
The concept of stack is extremely important in computer science and .pdfarihantsherwani
 
STACK USING LISTS.pptx
STACK USING LISTS.pptxSTACK USING LISTS.pptx
STACK USING LISTS.pptxBaby81727
 

Ähnlich wie Stack (20)

stack-111104232459-phpapp02.pdf
stack-111104232459-phpapp02.pdfstack-111104232459-phpapp02.pdf
stack-111104232459-phpapp02.pdf
 
stack-Intro.pptx
stack-Intro.pptxstack-Intro.pptx
stack-Intro.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 structure lab manual
Data structure lab manualData structure lab manual
Data structure lab manual
 
Stacks in c++
Stacks in c++Stacks in c++
Stacks in c++
 
CH4.pptx
CH4.pptxCH4.pptx
CH4.pptx
 
Stack linked list
Stack linked listStack linked list
Stack linked list
 
Data structures
Data structures Data structures
Data structures
 
Stacks
StacksStacks
Stacks
 
Infix-Postfix expression conversion
Infix-Postfix expression conversionInfix-Postfix expression conversion
Infix-Postfix expression conversion
 
Unit 3 stack
Unit   3 stackUnit   3 stack
Unit 3 stack
 
Data Structures: Stacks (Part 1)
Data Structures: Stacks (Part 1)Data Structures: Stacks (Part 1)
Data Structures: Stacks (Part 1)
 
Lec5-Stack-bukc-28022024-112316am (1) .pptx
Lec5-Stack-bukc-28022024-112316am (1) .pptxLec5-Stack-bukc-28022024-112316am (1) .pptx
Lec5-Stack-bukc-28022024-112316am (1) .pptx
 
Stacks,queues,linked-list
Stacks,queues,linked-listStacks,queues,linked-list
Stacks,queues,linked-list
 
The concept of stack is extremely important in computer science and .pdf
The concept of stack is extremely important in computer science and .pdfThe concept of stack is extremely important in computer science and .pdf
The concept of stack is extremely important in computer science and .pdf
 
U3.stack queue
U3.stack queueU3.stack queue
U3.stack queue
 
STACK USING LISTS.pptx
STACK USING LISTS.pptxSTACK USING LISTS.pptx
STACK USING LISTS.pptx
 
Stack Operation In Data Structure
Stack Operation In Data Structure Stack Operation In Data Structure
Stack Operation In Data Structure
 
DS MOD2 (1) (1).pptx
DS MOD2 (1) (1).pptxDS MOD2 (1) (1).pptx
DS MOD2 (1) (1).pptx
 
MO 2020 DS Stacks 3 AB.ppt
MO 2020 DS Stacks 3 AB.pptMO 2020 DS Stacks 3 AB.ppt
MO 2020 DS Stacks 3 AB.ppt
 

Kürzlich hochgeladen

20230202 - Introduction to tis-py
20230202 - Introduction to tis-py20230202 - Introduction to tis-py
20230202 - Introduction to tis-pyJamie (Taka) Wang
 
Videogame localization & technology_ how to enhance the power of translation.pdf
Videogame localization & technology_ how to enhance the power of translation.pdfVideogame localization & technology_ how to enhance the power of translation.pdf
Videogame localization & technology_ how to enhance the power of translation.pdfinfogdgmi
 
COMPUTER 10 Lesson 8 - Building a Website
COMPUTER 10 Lesson 8 - Building a WebsiteCOMPUTER 10 Lesson 8 - Building a Website
COMPUTER 10 Lesson 8 - Building a Websitedgelyza
 
Basic Building Blocks of Internet of Things.
Basic Building Blocks of Internet of Things.Basic Building Blocks of Internet of Things.
Basic Building Blocks of Internet of Things.YounusS2
 
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve Decarbonization
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve DecarbonizationUsing IESVE for Loads, Sizing and Heat Pump Modeling to Achieve Decarbonization
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve DecarbonizationIES VE
 
UiPath Studio Web workshop series - Day 6
UiPath Studio Web workshop series - Day 6UiPath Studio Web workshop series - Day 6
UiPath Studio Web workshop series - Day 6DianaGray10
 
NIST Cybersecurity Framework (CSF) 2.0 Workshop
NIST Cybersecurity Framework (CSF) 2.0 WorkshopNIST Cybersecurity Framework (CSF) 2.0 Workshop
NIST Cybersecurity Framework (CSF) 2.0 WorkshopBachir Benyammi
 
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019IES VE
 
KubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCost
KubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCostKubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCost
KubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCostMatt Ray
 
Cybersecurity Workshop #1.pptx
Cybersecurity Workshop #1.pptxCybersecurity Workshop #1.pptx
Cybersecurity Workshop #1.pptxGDSC PJATK
 
Meet the new FSP 3000 M-Flex800™
Meet the new FSP 3000 M-Flex800™Meet the new FSP 3000 M-Flex800™
Meet the new FSP 3000 M-Flex800™Adtran
 
AI Fame Rush Review – Virtual Influencer Creation In Just Minutes
AI Fame Rush Review – Virtual Influencer Creation In Just MinutesAI Fame Rush Review – Virtual Influencer Creation In Just Minutes
AI Fame Rush Review – Virtual Influencer Creation In Just MinutesMd Hossain Ali
 
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPA
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPAAnypoint Code Builder , Google Pub sub connector and MuleSoft RPA
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPAshyamraj55
 
Linked Data in Production: Moving Beyond Ontologies
Linked Data in Production: Moving Beyond OntologiesLinked Data in Production: Moving Beyond Ontologies
Linked Data in Production: Moving Beyond OntologiesDavid Newbury
 
Nanopower In Semiconductor Industry.pdf
Nanopower  In Semiconductor Industry.pdfNanopower  In Semiconductor Industry.pdf
Nanopower In Semiconductor Industry.pdfPedro Manuel
 
Empowering Africa's Next Generation: The AI Leadership Blueprint
Empowering Africa's Next Generation: The AI Leadership BlueprintEmpowering Africa's Next Generation: The AI Leadership Blueprint
Empowering Africa's Next Generation: The AI Leadership BlueprintMahmoud Rabie
 
Designing A Time bound resource download URL
Designing A Time bound resource download URLDesigning A Time bound resource download URL
Designing A Time bound resource download URLRuncy Oommen
 
Comparing Sidecar-less Service Mesh from Cilium and Istio
Comparing Sidecar-less Service Mesh from Cilium and IstioComparing Sidecar-less Service Mesh from Cilium and Istio
Comparing Sidecar-less Service Mesh from Cilium and IstioChristian Posta
 
Artificial Intelligence & SEO Trends for 2024
Artificial Intelligence & SEO Trends for 2024Artificial Intelligence & SEO Trends for 2024
Artificial Intelligence & SEO Trends for 2024D Cloud Solutions
 

Kürzlich hochgeladen (20)

20230202 - Introduction to tis-py
20230202 - Introduction to tis-py20230202 - Introduction to tis-py
20230202 - Introduction to tis-py
 
Videogame localization & technology_ how to enhance the power of translation.pdf
Videogame localization & technology_ how to enhance the power of translation.pdfVideogame localization & technology_ how to enhance the power of translation.pdf
Videogame localization & technology_ how to enhance the power of translation.pdf
 
COMPUTER 10 Lesson 8 - Building a Website
COMPUTER 10 Lesson 8 - Building a WebsiteCOMPUTER 10 Lesson 8 - Building a Website
COMPUTER 10 Lesson 8 - Building a Website
 
Basic Building Blocks of Internet of Things.
Basic Building Blocks of Internet of Things.Basic Building Blocks of Internet of Things.
Basic Building Blocks of Internet of Things.
 
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve Decarbonization
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve DecarbonizationUsing IESVE for Loads, Sizing and Heat Pump Modeling to Achieve Decarbonization
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve Decarbonization
 
UiPath Studio Web workshop series - Day 6
UiPath Studio Web workshop series - Day 6UiPath Studio Web workshop series - Day 6
UiPath Studio Web workshop series - Day 6
 
NIST Cybersecurity Framework (CSF) 2.0 Workshop
NIST Cybersecurity Framework (CSF) 2.0 WorkshopNIST Cybersecurity Framework (CSF) 2.0 Workshop
NIST Cybersecurity Framework (CSF) 2.0 Workshop
 
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019
 
KubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCost
KubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCostKubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCost
KubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCost
 
Cybersecurity Workshop #1.pptx
Cybersecurity Workshop #1.pptxCybersecurity Workshop #1.pptx
Cybersecurity Workshop #1.pptx
 
Meet the new FSP 3000 M-Flex800™
Meet the new FSP 3000 M-Flex800™Meet the new FSP 3000 M-Flex800™
Meet the new FSP 3000 M-Flex800™
 
AI Fame Rush Review – Virtual Influencer Creation In Just Minutes
AI Fame Rush Review – Virtual Influencer Creation In Just MinutesAI Fame Rush Review – Virtual Influencer Creation In Just Minutes
AI Fame Rush Review – Virtual Influencer Creation In Just Minutes
 
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPA
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPAAnypoint Code Builder , Google Pub sub connector and MuleSoft RPA
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPA
 
Linked Data in Production: Moving Beyond Ontologies
Linked Data in Production: Moving Beyond OntologiesLinked Data in Production: Moving Beyond Ontologies
Linked Data in Production: Moving Beyond Ontologies
 
Nanopower In Semiconductor Industry.pdf
Nanopower  In Semiconductor Industry.pdfNanopower  In Semiconductor Industry.pdf
Nanopower In Semiconductor Industry.pdf
 
Empowering Africa's Next Generation: The AI Leadership Blueprint
Empowering Africa's Next Generation: The AI Leadership BlueprintEmpowering Africa's Next Generation: The AI Leadership Blueprint
Empowering Africa's Next Generation: The AI Leadership Blueprint
 
20150722 - AGV
20150722 - AGV20150722 - AGV
20150722 - AGV
 
Designing A Time bound resource download URL
Designing A Time bound resource download URLDesigning A Time bound resource download URL
Designing A Time bound resource download URL
 
Comparing Sidecar-less Service Mesh from Cilium and Istio
Comparing Sidecar-less Service Mesh from Cilium and IstioComparing Sidecar-less Service Mesh from Cilium and Istio
Comparing Sidecar-less Service Mesh from Cilium and Istio
 
Artificial Intelligence & SEO Trends for 2024
Artificial Intelligence & SEO Trends for 2024Artificial Intelligence & SEO Trends for 2024
Artificial Intelligence & SEO Trends for 2024
 

Stack

  • 2. What is a Stack  Stack Operations  LIFO Stack  Animation Depicting Push Operation  Animation Depicting Pop Operation  Array Implementation of Stack  Applications of stack Checking for balanced braces Converting Infix Expression to Postfix Postfix calculator
  • 3. What is a Stack? A stack is a Last In, First Out (LIFO) data structure,objects inserted last are the first to come out of the stack Anything added to the stack goes on the “top” of the stack Anything removed from the stack is taken from the “top” of the stack Things are removed in the reverse order from that in which they were inserted
  • 4. Stack Operations  PUSH Adds the object to the top of the stack  POP Removes the object at the top of the stack and returns it  PEEK Returns the top object of the stack but does not remove it from the stack  ISEMPTY Returns True if Stack is empty
  • 5. A LIFO Stack Push Pop Stack Pointer Top Bottom
  • 8. array Implementation of Stack A[1] A[2] …. …. …. A[n] Push X w y x Stack pointer Stack pointer After many Stack pointer J=2 J=3 Push Ops J=n Before Push After Push Stack Full Pop w y After many Pop ops Stack Pointer Stack Pointer Stack Pointer J=0 J=2 J=3 Stack Empty After Pop Before Pop
  • 9. Checking for Balanced Braces  ([]({()}[()])) is balanced; ([]({()}[())]) is not  Simple counting is not enough to check balance  You can do it with a stack: going left to right,  If you see a (, [, or {, push it on the stack  If you see a ), ], or }, pop the stack and check whether you got the corresponding (, [, or {  When you reach the end, check that the stack is empty
  • 11. Converting Infix Expressions to Equivalent Postfix Expressions  Infix Expression a+b  Postfix Expression ab+  An infix expression can be evaluated by first being converted into an equivalent postfix expression  Facts about converting from infix to postfix  Operands always stay in the same order with respect to one another  All parentheses are removed
  • 12. Algorithm : Converting Infix Expression to Postfix using stack Suppose X is an arithmetic expression written in infix notation. This algorithm finds the equivalent postfix expression Y. 1. Push "(" onto STACK, and add ")" to the end of X. 2. Scan X from left to right and REPEAT Steps 3 to 6 for each element of X UNTIL the STACK is empty : 3. If an operand is encountered, add it to Y. 4. If a left parenthesis is encountered, push it onto STACK. 5. If an operator is encountered, then : (a) Repeatedly pop from STACK and add to Y each operator (on the top of STACK) which has the same precedence as or higher precedence than operator. (b) Add operator to STACK. /* End of If structure * / 6. If a right parenthesis is encountered, then : (a) Repeatedly pop from STACK and add to Y each operator (on the top of STACK) until a left parenthesis is encountered. (b) Remove the left parenthesis. [Do not add the left parenthesis to Y]. /* End of If structure * / /* End of Step 2 loop * / 7. END.
  • 13. A trace of the algorithm that converts the infix expression a - (b + c * d)/e to postfix form
  • 14. A postfix calculator  When an operand is entered, the calculator  Pushes it onto a stack  When an operator is entered, the calculator  Applies it to the top (one or two, depending on unary or binary operator) operand(s) of the stack  Pops the operands from the stack  Pushes the result of the operation on the stack
  • 15. The action of a postfix calculator when evaluating the expression 2 * (3 + 4) Postfix Notation--- 2 3 4 + *
  • 16. Acknowledgement  Data Structures BY Tanenbaum  Internet  Computer Science C++ A textbook for class XII -By Sumita Arora prepared by- Seema kaushik, Computer science department, DAV public school, sector-14, gurgaon