infix to postfix

infix to postfix - InfixPostfix InfixExpression:

Info iconThis preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon
Infix - Postfix
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 2
Infix Expression :   Any expression in the standard form like "2*3-4/5" is an Infix(Inorder) expression. Postfix Expression :   The Postfix(Postorder) form of the above expression is "23*45/-". Infix to Postfix Conversion :   In normal algebra we use the infix notation like a+b*c. The corresponding postfix notation is abc*+. The  algorithm for the conversion is as follows :  Scan the  Infix string  from left to right.  Initialise an empty stack.  If the scannned character is an operand, add it to the  Postfix string . If the scanned  character is an operator and if the  stack  is empty  Push  the character to  stack If the scanned character is an Operand and the  stack  is not empty, compare the  precedence of the character with the element on top of the  stack  ( topStack ). If  topStack  has higher precedence over the scanned character 
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 4
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 05/05/2011 for the course CS 677 taught by Professor Adom during the Spring '11 term at UFRO.

Page1 / 4

infix to postfix - InfixPostfix InfixExpression:

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online