Let I have some expression as 2*3/(2-1) +5*(4-1)
. It is infix notation. Of course I can construct for this expression a tree that you can see on image. enter image description here
Then, let's write this expression in postfix and prefix forms.
Postfix: 2 3 * 2 1 - / 5 4 1 - * +
Prefix : + / * 2 3 - 2 1 * 5 - 4 1
And the question is: a tree for above expressions will be the same? If not,how to construct it?