The document contains two examples of expressions and their postfix and prefix notation representations:
1. (A+B*C+(D*E+F)*G) is converted to ABC*+DE*F+G*+ in postfix notation and ++A*BC*+*DEFG in prefix notation.
2. A+(B*C-(D/E^F)*G)*H is converted to ABC*DEF^/G*-H*+ in postfix notation and A -*BC*/D^EFG H in prefix notation.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
105 views3 pages
Infix To Postfix and Prefix
The document contains two examples of expressions and their postfix and prefix notation representations:
1. (A+B*C+(D*E+F)*G) is converted to ABC*+DE*F+G*+ in postfix notation and ++A*BC*+*DEFG in prefix notation.
2. A+(B*C-(D/E^F)*G)*H is converted to ABC*DEF^/G*-H*+ in postfix notation and A -*BC*/D^EFG H in prefix notation.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3
(A+B*C+(D*E+F)*G)
Sr No Expression Stack Postfix
0 ( ( 1 A ( A 2 + (+ A 3 B (+ AB 4 * (+* AB 5 C (+* ABC 6 + (+ ABC*+ 7 ( (+( ABC*+ 8 D (+( ABC*+D 9 * (+(* ABC*+D 10 E (+(* ABC*+DE 11 + (+(+ ABC*+DE* 12 F (+(+ ABC*+DE*F 13 ) (+ ABC*+DE*F+ 14 * (+* ABC*+DE*F+ 15 G (+* ABC*+DE*F+G 16 ) ABC*+DE*F+G*+ 17 ABC*+DE*F+G*+
Sr No Expression Stack Prefix
0 ( ( 1 A ( A 2 + (+ A 3 B (+ AB 4 * (+* AB 5 C (+* ABC 6 + (+ +A*BC 7 ( (+( +A*BC 8 D (+( +A*BC D 9 * (+(* +A*BC D 10 E (+(* +A*BC D E 11 + (+(+ +A*BC *DE 12 F (+(+ +A*BC *DE F 13 ) (+ +A*BC +*DEF 14 * (+* +A*BC +*DEF 15 G (+* +A*BC +*DEF G 16 ) ++A*BC*+*DEFG 17 ++A*BC*+*DEFG A+(B*C-(D/E^F)*G)*H
Sr No Expression Stack Postfix
0 A A 1 + + A 2 ( +( A 3 B +( AB 4 * +(* AB 5 C +(* ABC 6 - +(- ABC* 7 ( +(-( ABC* 8 D +(-( ABC*D 9 / +(-(/ ABC*D 10 E +(-(/ ABC*DE 11 ^ +(-(/^ ABC*DE 12 F +(-(/^ ABC*DEF 13 ) +(- ABC*DEF^/ 14 * +(-* ABC*DEF^/ 15 G +(-* ABC*DEF^/G 16 ) + ABC*DEF^/G*- 17 * +* ABC*DEF^/G*- 18 H +* ABC*DEF^/G*-H 19 ABC*DEF^/G*-H*+
Sr No Expression Stack Prefix
0 A A 1 + + A 2 ( +( A 3 B +( AB 4 * +(* AB 5 C +(* ABC 6 - +(- A *BC 7 ( +(-( A *BC 8 D +(-( A *BC D 9 / +(-(/ A *BC D 10 E +(-(/ A *BC D E 11 ^ +(-(/^ A *BC D E 12 F +(-(/^ A *BC D E F 13 ) +(- A *BC /D^EF 14 * +(-* A *BC /D^EF 15 G +(-* A *BC /D^EF G 16 ) + A -*BC*/D^EFG 17 * +* A -*BC*/D^EFG 18 H +* A -*BC*/D^EFG H 19 +A*-*BC*/D^EFGH