SlideShare a Scribd company logo
1 of 3
Converting Infix to RPN
1. By hand: Represent infix expression as an expression tree:

    A * B + C         A * (B + C)      ((A + B) * C) / (D - E)

          +              *                                 /

                     A                             *               -
      *         C              +

A         B                                +           C       D       E
                           B       C

                                       A       B
/
Traverse the tree in Left-Right-Parent
order (postorder) to get RPN:
                                                     *               -
    AB+C*DE-/
                                             +           C       D       E
Traverse tree in Parent-Left-Right                           /
order (preorder) to get prefix:          A       B

                                                     *               -
   / * + A BC- D E
                                             +           C       D       E

Traverse tree in Left-Parent-Right                           /
order (inorder) to get infix             A       B
— must insert ()'s                                   *               -

 ( ((A + B) * C) (D - E) )
                /                            +           C       D       E


                                         A       B
2. By hand: "Fully parenthesize-move-erase" method:
1. Fully parenthesize the expression.
2. Replace each right parenthesis by the corresponding operator.
3. Erase all left parentheses.
Examples:

A * B + C   → ((A * B) + C)        A * (B + C)   → (A * (B + C) )
            → ((A B * C +                        → (A (B C + *
            → A B * C +                          → A B C + *


Exercise:

 ((A + B) * C) / (D - E)

More Related Content

What's hot

TechMathI - 2.6
TechMathI - 2.6TechMathI - 2.6
TechMathI - 2.6lmrhodes
 
Literal equations
Literal equationsLiteral equations
Literal equationscandicef
 
Forms Of Quadratic
Forms Of QuadraticForms Of Quadratic
Forms Of Quadraticsoflaman
 
2.1 graphing quadratic functions
2.1 graphing quadratic functions2.1 graphing quadratic functions
2.1 graphing quadratic functionslothomas
 
Derivative assignment
Derivative assignmentDerivative assignment
Derivative assignmentcfk
 
KARNAUGH MAP(K-MAP)
KARNAUGH MAP(K-MAP)KARNAUGH MAP(K-MAP)
KARNAUGH MAP(K-MAP)mihir jain
 
Geom3-4Final
Geom3-4FinalGeom3-4Final
Geom3-4Finalkquarton
 
Algebra 1 identity and equality properties
Algebra 1   identity and equality propertiesAlgebra 1   identity and equality properties
Algebra 1 identity and equality propertiesmathriot
 
Quads factored form updated with answers
Quads factored form updated with answers Quads factored form updated with answers
Quads factored form updated with answers jbianco9910
 
Monad and Algebraic Design in Functional Programming
Monad and Algebraic Design in Functional ProgrammingMonad and Algebraic Design in Functional Programming
Monad and Algebraic Design in Functional ProgrammingNamuk Park
 
4.2 Multiplying Matrices
4.2 Multiplying Matrices4.2 Multiplying Matrices
4.2 Multiplying Matriceshisema01
 
Working with Exponents Unit
Working with Exponents UnitWorking with Exponents Unit
Working with Exponents Unitkwilkinson07
 

What's hot (19)

TechMathI - 2.6
TechMathI - 2.6TechMathI - 2.6
TechMathI - 2.6
 
Function all
Function allFunction all
Function all
 
الترددات
التردداتالترددات
الترددات
 
Literal equations
Literal equationsLiteral equations
Literal equations
 
scribe cn
scribe cnscribe cn
scribe cn
 
Forms Of Quadratic
Forms Of QuadraticForms Of Quadratic
Forms Of Quadratic
 
2.1 graphing quadratic functions
2.1 graphing quadratic functions2.1 graphing quadratic functions
2.1 graphing quadratic functions
 
Derivative assignment
Derivative assignmentDerivative assignment
Derivative assignment
 
KARNAUGH MAP(K-MAP)
KARNAUGH MAP(K-MAP)KARNAUGH MAP(K-MAP)
KARNAUGH MAP(K-MAP)
 
Geom3-4Final
Geom3-4FinalGeom3-4Final
Geom3-4Final
 
Algebra 1 identity and equality properties
Algebra 1   identity and equality propertiesAlgebra 1   identity and equality properties
Algebra 1 identity and equality properties
 
Introduction
IntroductionIntroduction
Introduction
 
CRMS Calculus 2010 May 5, 2010
CRMS Calculus 2010 May 5, 2010CRMS Calculus 2010 May 5, 2010
CRMS Calculus 2010 May 5, 2010
 
Quads factored form updated with answers
Quads factored form updated with answers Quads factored form updated with answers
Quads factored form updated with answers
 
Monad and Algebraic Design in Functional Programming
Monad and Algebraic Design in Functional ProgrammingMonad and Algebraic Design in Functional Programming
Monad and Algebraic Design in Functional Programming
 
Afshaa fybca1
Afshaa fybca1Afshaa fybca1
Afshaa fybca1
 
4.2 Multiplying Matrices
4.2 Multiplying Matrices4.2 Multiplying Matrices
4.2 Multiplying Matrices
 
NUMBER SYSTEM
NUMBER SYSTEMNUMBER SYSTEM
NUMBER SYSTEM
 
Working with Exponents Unit
Working with Exponents UnitWorking with Exponents Unit
Working with Exponents Unit
 

Viewers also liked

Six sigma-statistical-definition-2
Six sigma-statistical-definition-2Six sigma-statistical-definition-2
Six sigma-statistical-definition-2SHASHI P MISHRA
 
Conference at Legend 7th May 2008 ICEI 2008 UNESCO & UM
Conference at Legend 7th May 2008 ICEI 2008 UNESCO & UMConference at Legend 7th May 2008 ICEI 2008 UNESCO & UM
Conference at Legend 7th May 2008 ICEI 2008 UNESCO & UMcomputerrravi ravichandran
 
An Introduction To Six Sigma
An Introduction To Six SigmaAn Introduction To Six Sigma
An Introduction To Six SigmaBrian Bulow
 
Introduction to FMEA/FMECA
Introduction to FMEA/FMECAIntroduction to FMEA/FMECA
Introduction to FMEA/FMECAMichael Herman
 
Six sigma simply explained
Six sigma simply explainedSix sigma simply explained
Six sigma simply explainedgaurav_einstien
 
Risk management using FMEA in pharma
Risk management using FMEA in pharmaRisk management using FMEA in pharma
Risk management using FMEA in pharmaSandeep Naik
 
Six Sigma Final
Six Sigma FinalSix Sigma Final
Six Sigma Finalanubhuti10
 
Process Failure Modes & Effects Analysis (PFMEA)
Process Failure Modes & Effects Analysis (PFMEA)Process Failure Modes & Effects Analysis (PFMEA)
Process Failure Modes & Effects Analysis (PFMEA)Anand Subramaniam
 
FMEA 4th Edition for Beginer
FMEA 4th Edition for BeginerFMEA 4th Edition for Beginer
FMEA 4th Edition for BeginerNukool Thanuanram
 
Presentation introduction to six sigma
Presentation   introduction to six sigmaPresentation   introduction to six sigma
Presentation introduction to six sigmajpanchpor
 
FMEA Introduction.ppt
FMEA Introduction.pptFMEA Introduction.ppt
FMEA Introduction.pptbowerj
 
Failure Mode Effect Analysis (FMEA)
Failure Mode Effect Analysis (FMEA)Failure Mode Effect Analysis (FMEA)
Failure Mode Effect Analysis (FMEA)DEEPAK SAHOO
 
Fmea Handbook V4.1[1][1]
Fmea Handbook V4.1[1][1]Fmea Handbook V4.1[1][1]
Fmea Handbook V4.1[1][1]ExerciseLeanLLC
 

Viewers also liked (20)

Six sigma-statistical-definition-2
Six sigma-statistical-definition-2Six sigma-statistical-definition-2
Six sigma-statistical-definition-2
 
Conference at Legend 7th May 2008 ICEI 2008 UNESCO & UM
Conference at Legend 7th May 2008 ICEI 2008 UNESCO & UMConference at Legend 7th May 2008 ICEI 2008 UNESCO & UM
Conference at Legend 7th May 2008 ICEI 2008 UNESCO & UM
 
The 10 most common fmea mistakes
The 10 most common fmea mistakes The 10 most common fmea mistakes
The 10 most common fmea mistakes
 
An Introduction To Six Sigma
An Introduction To Six SigmaAn Introduction To Six Sigma
An Introduction To Six Sigma
 
Introduction to FMEA/FMECA
Introduction to FMEA/FMECAIntroduction to FMEA/FMECA
Introduction to FMEA/FMECA
 
Six sigma simply explained
Six sigma simply explainedSix sigma simply explained
Six sigma simply explained
 
Best Damn D-FMEA Method!
Best Damn D-FMEA Method!Best Damn D-FMEA Method!
Best Damn D-FMEA Method!
 
Process fmea
Process fmea Process fmea
Process fmea
 
Risk management using FMEA in pharma
Risk management using FMEA in pharmaRisk management using FMEA in pharma
Risk management using FMEA in pharma
 
Six Sigma Final
Six Sigma FinalSix Sigma Final
Six Sigma Final
 
Process Failure Modes & Effects Analysis (PFMEA)
Process Failure Modes & Effects Analysis (PFMEA)Process Failure Modes & Effects Analysis (PFMEA)
Process Failure Modes & Effects Analysis (PFMEA)
 
Process F.M.E.A
Process F.M.E.AProcess F.M.E.A
Process F.M.E.A
 
FMEA 4th Edition for Beginer
FMEA 4th Edition for BeginerFMEA 4th Edition for Beginer
FMEA 4th Edition for Beginer
 
Presentation introduction to six sigma
Presentation   introduction to six sigmaPresentation   introduction to six sigma
Presentation introduction to six sigma
 
FMEA Introduction.ppt
FMEA Introduction.pptFMEA Introduction.ppt
FMEA Introduction.ppt
 
Quality Risk management Application of FMEA
Quality Risk management  Application of FMEAQuality Risk management  Application of FMEA
Quality Risk management Application of FMEA
 
Failure Mode Effect Analysis (FMEA)
Failure Mode Effect Analysis (FMEA)Failure Mode Effect Analysis (FMEA)
Failure Mode Effect Analysis (FMEA)
 
Fmea Handbook V4.1[1][1]
Fmea Handbook V4.1[1][1]Fmea Handbook V4.1[1][1]
Fmea Handbook V4.1[1][1]
 
Six Sigma
Six SigmaSix Sigma
Six Sigma
 
Six sigma ppt
Six sigma pptSix sigma ppt
Six sigma ppt
 

Converting Infix to RPN

  • 1. Converting Infix to RPN 1. By hand: Represent infix expression as an expression tree: A * B + C A * (B + C) ((A + B) * C) / (D - E) + * / A * - * C + A B + C D E B C A B
  • 2. / Traverse the tree in Left-Right-Parent order (postorder) to get RPN: * - AB+C*DE-/ + C D E Traverse tree in Parent-Left-Right / order (preorder) to get prefix: A B * - / * + A BC- D E + C D E Traverse tree in Left-Parent-Right / order (inorder) to get infix A B — must insert ()'s * - ( ((A + B) * C) (D - E) ) / + C D E A B
  • 3. 2. By hand: "Fully parenthesize-move-erase" method: 1. Fully parenthesize the expression. 2. Replace each right parenthesis by the corresponding operator. 3. Erase all left parentheses. Examples: A * B + C → ((A * B) + C) A * (B + C) → (A * (B + C) ) → ((A B * C + → (A (B C + * → A B * C + → A B C + * Exercise: ((A + B) * C) / (D - E)