algorithms.tutorialhorizon.com
Evaluation of Prefix Expressions (Polish Notation) | Set 2 | Algorithms
how to evaluate prefix expression for any number ( not necessarily single digit.) Prefix notation is a notation for writing arithmetic expressions in which the operands appear after their operators. Let's assume the below Operands are real numbers (could be multiple digits). Permitted operators: +,-, *, /, ^(exponentiation) Blanks are used as a separator in expression. Parenthesis are permitted Example: Postfix: - / * 20 * 50 + 3 6 300 2 Output: 28