Postfix_to_infix
Convert an expression written in postfix notation to infix notation
A postfix expression is one where each operator comes after it's operands, while in an infix expression the operator is in between the operands. For example, the postfix expression ab+c/ is equivalent to (a+b)/c in infix notation
Your code should take a string of arbitrary length, convert it to postfix and return the equivalent infix expression
Your Solution should detect invalid expressions and output "invalid" in that case.
The only valid operators are +, -, *,/ and ^ (exponentiation operator)
You can assume that all operands are single characters.
Operands and operators may or may not be separated by spaces.
Your solution must enclose expression in the minimal set of parentheses to appropriately preserve the order of operations.
Last updated
Was this helpful?