Contents
Page-10
Prev
Next
Page+10
Index
Trees and Reverse Polish
It is easy to convert a tree representation to RPN by a postorder
recursive algorithm:
- If the expression to be converted is an operand (leaf node),
put it into the output.
- Otherwise, the expression is a subtree. Convert the left-hand
operand, then convert the right-hand operand, then put the operator into the
output.