Infix to Postfix expression

March 27, 2022 · Team EasyExamNotes · 1 min read (est.) · 0 comments

Share on WhatsApp

Infix expression : A+(B*C-(D/E↑F)*ε)*H

  1. Put operands values in to output column
  2. Put non operands valued in to stack column
  3. On inserting closing parenthesis ‘)’ into stack POP and PUSH elements between ( ) to the output column from right to left scan.
  4. After scanning all the shymbols in expression, POP all the values from stack and PUSH in to output columns.
 Symbol ScannedStackOutput
1A A
2++A
3(+(A
4B+(AB
5*+(*AB
6C+(*ABC
7–+(-ABC*
8(+(-(ABC*
9D+(-(ABC*D
10/+(-(/ABC*D
11E+(-(/ABC*DE
12↑+(-(/↑ABC*DE
13F+(-(/↑ABC*DEF
14)+(-ABC*DEF↑/
15*+(-*ABC*DEF↑/
16ε+(-*εABC*DEF↑/
17)+ABC*DEF↑/ε*-
18*+*ABC*DEF↑/ε*-
19H+*ABC*DEF↑/ε*-H
20  ABC*DEF↑/ε*-H*+

Postfix expression : ABC*DEF↑/ε*-H*+

Discussion

Ask a question, share your thoughts or report an error.

Sign in to participate in the discussion.

Join the discussion