Similar questions 1 more →
Stacks & Queues


Answer & solution
Answer: 3 x 1 + log * a 2 / − (no official key was published)
Step through it (14 steps)
First parenthesize by the usual precedence and the unary function call: (3*log(x+1))−(a/2). A postfix traversal writes operands before their operator. The subtree x+1 becomes x 1 +; applying the unary log appends log, giving x 1 + log. Multiplication by 3 becomes 3 x 1 + log *. Independently, a/2 becomes a 2 /. Finally append subtraction after both subexpressions:
3 x 1 + log * a 2 / −
The spaces separate tokens, and log is one unary operator rather than three operands. Evaluating this stack form pushes 3, forms log(x+1), multiplies, forms a/2, then subtracts the right value from the left. Reversing the final operands would change the expression.