It is possible to represent arithmetic, parenthesized expressions using a tree. If a node is an operator, such as a plus or a division sign, then each of the two children must be either a number or an expression which will evaluate to a number. In other words, the two children of an operator will be its operands.

Figure %: Simple Arithmetic Tree

**Problem : **
Convert the following expression into such a tree:
((3 + 4)*5)/6

Figure %: Solution 1

**Problem : **
Convert the following expression into such a tree:
3 + 4*(5/6)

Figure %: Solution 2

**Problem : **
How could you use this tree representation to devise a scheme to represent
the expressions without using any parentheses. Hint: Consider a the
different sorts of traversals. See the recursion
SparkNote
for information on tree traversals.

2 3 4 + *

means add the 3 and the 4 and then multiply by 2. Its parenthesized equivalent is: 2*(3 + 4)

Take a Study Break!