0% found this document useful (0 votes)
29 views2 pages

Infix to Postfix Conversion Guide

The document describes how to convert expressions between infix, prefix, and postfix notations. It provides an example of converting the infix expression (A * (B + C) – D * E) / F to postfix by parsing from left to right. It also explains how to convert the same infix expression to prefix by reversing the string and parsing from left to right, and provides examples of converting between postfix and infix notations.

Uploaded by

Sudike Nelson
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
29 views2 pages

Infix to Postfix Conversion Guide

The document describes how to convert expressions between infix, prefix, and postfix notations. It provides an example of converting the infix expression (A * (B + C) – D * E) / F to postfix by parsing from left to right. It also explains how to convert the same infix expression to prefix by reversing the string and parsing from left to right, and provides examples of converting between postfix and infix notations.

Uploaded by

Sudike Nelson
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Converting Infix to Postfix

(A * (B + C) – D * E) / F

Parse the given input string from left to right

      Input         Post-Fix


            Stack
   Expression    Expression

       (

       A A

       +              + A

       ( A

        B AB

        +            + + AB

        C            ++ ABC

         )            + ABC+

        -             - ABC++

        D             - ABC+D

        *             - ABC+D*

       )           ABC+D*-

       /           /

       F ABC+D*-F

   ABC+D*-F/

Converting Infix to Prefix

(A * (B + C) – D * E) / F

 Reverse the input string first and parse the given input string from left to right

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

The final output string obtained is reversed again to obtain prefix expression

     /+A-+BC*DEF
Prefix expression to infix 
+/A-BCD
A/B-C+D

Post fix expression to infix

 A B / C + D *   
  A/B+C*D

You might also like