Wednesday, March 13, 2013

Postfix to Infix



  • Problem 3: Postfix to Infix

A popular example of using a stack in data structure courses is to convert an infix expression (e.g. 2 * 5 + 3) to postfix (2 5 * 3 +).
The reverse process is slightly harder, particularly because a given postfix expression can convert to multiple infix expressions due to parentheses
http://www.eecis.udel.edu/~breech/contest.inet.fall.03/problems/toinfix.html


  • Postfix to Infix Notation 

http://www.youtube.com/watch?v=OlRENYiiIiw



  • Converting Postfix Expressions to Infix



    The postfix expression is scanned from left to right.
    If a token is a number, the token is pushed onto the stack.
    If a token is an operator, the top two infix subexpressions are popped from the stack and a new infix expression is constructed by combining these subexpressions with the operator in a normal infix manner. The resulting expression is then pushed onto the stack. Initially, we will place each subexpression in parentheses to ensure the proper order of evaluation in the final expression.


http://www.codeproject.com/Articles/405361/Converting-Postfix-Expressions-to-Infix

No comments:

Post a Comment