slammer14
asked on
Postfix to Infix
I am able to understand the infix to postfix, however I am having trouble with putting the parentheses back into the infix if I start with postfix.
Have looked at possibility of using 2 stacks, however I would like to
use only one.
I may not have made it clear.
What I need is to convert it to a fully parenthesized infix expression.
I don't understand how I get the parentheses in right spot
slammer 14
Please help!!
slammer14
Have looked at possibility of using 2 stacks, however I would like to
use only one.
I may not have made it clear.
What I need is to convert it to a fully parenthesized infix expression.
I don't understand how I get the parentheses in right spot
slammer 14
Please help!!
slammer14
put some code here what U have tried so that we can help U
What are the elements on your stack? infix strings?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Hi,
Here I am giving how we can evaluate postfix expression
Suppose the postfix expression is
ab+c*
The corressponding infix expression is
(a+b)*c
element stack
a a <- Top
b a,b <- Top
+ perform b+a & result is
put onto top of the stack(a)
c a,c <- Top
* a*c
I think this will help U.
Sisu
Here I am giving how we can evaluate postfix expression
Suppose the postfix expression is
ab+c*
The corressponding infix expression is
(a+b)*c
element stack
a a <- Top
b a,b <- Top
+ perform b+a & result is
put onto top of the stack(a)
c a,c <- Top
* a*c
I think this will help U.
Sisu
ASKER
Edited text of question.
ASKER
Sisu thanks it helps a little, however I don't need to calculate answer I just have to give the expression.
My email is slammer14@hotmail.com
Thanks
slammer
My email is slammer14@hotmail.com
Thanks
slammer
ASKER
Adjusted points to 50
While evaluation is easy from postfix, you may find infix conversion more convenient from prefix.