we know that in infix expression, operator that is being evaluated at last is root.
Therefore, 3∗log(x+1)−a/2 infix expression can be shown in tree as-
- is evaluated at last here, so we can write it at first in tree, hence the root.
Similarly for other operators like
(x+1) is evaluated at very first therefore we can write it at last in the below tree.
Now traverse it in postfix fashion like Left Right Root, we can get the following postfix expression as:
3x1+log∗a2/−