Step1 : Push the delimiter “#” onto the stack.
Step2 : Read the characters one by one from the given infix expression
Step2 : Read the characters one by one from the given infix expression
- If the character is an operand ,place it on to the output.
- If the character(ch) is equal to an operator or any opening symbol,then pop a character (pch)from the stack.If the stack priority of pch >= infix priority of ch ,then put pch in the output and push th ch into stack,if the condition didn‟t get satisfied then push pch and c into the stack.
- If the character is a closing symbol,pop all the operators from the stack till it encounters its corresponding opening symbol and place it on the output and discard both the opening and closing symbols.
No comments:
Post a Comment