I am preparing for an exam where i couldn\'t understand the convertion of infix notation to polish notation for the below expression:
(a–b)/c*(d + e – f / g)
This is the algorithm using stack.
Just follow these simple steps.
1.Reverse the given infix expression.
2.Replace '(' with ')' and ')' with '(' in the reversed expression.
3.Now apply standard infix to postfix subroutine.
4.Reverse the founded postfix expression, this will give required prefix expression.
In case you find step 3 difficult consult http://scanftree.com/Data_Structure/infix-to-prefix
where a worked out example is also given.