algorithms.tutorialhorizon.com

Evaluation of Prefix Expressions (Reverse Polish Notation) | Set 1 | Algorithms

Prefix notation is a notation for writing arithmetic expressions in which the operands appear after their operators. Permitted operators: +,-, *, /, ^(exponentiation) Blanks are NOT permitted in expression. Parenthesis are permitted Example: Postfix: -/*2*5+3652 Output: 16 Explanation: Infix expression of above prefix is: 2 * (5 *(3+6))/5-2 which resolves to 16