# Thread: InOrder traversal : show tree

1. ## InOrder traversal : show tree

I am needing confirmation of the following:

Show the expression tree whose InOrder traversal is:

(5*2+(3*4-7))/(3+4/2)

Code:
```                                    '/'
/    \
/      \
/        \
/          \
/            \
'+'            '-'
/\              /\
/  \            /  \
/    \          /    \
/      \        /      \
'*'   '-'        '+'     2
/\      /\       /\
/  \    /  \     /  \
/    \  /    \   /    \
5    2  '*'   7   3    4
/ \
3   4```

2. Your tree to the right of the root is wrong... that's the tree for
3 + 4 - 2
but your equation you need to make the right subtree for is...
3 + 4 / 2

3. okay, 'cept for the keying error on my part on the one node;
this is a correct representation of the expression I gave as :

(5*2+(3*4-7))/(3+4/2) ???

I wasn't sure about the parts (3*4-7) and (3+4/2); I take it that
* and / are evaluated as the parent node over + and - . Is that right???

Now the next evaluation is to take the following expression tree and give the postfix expression using PostOrder traveral.

Code:
```                                    '/'
/    \
/      \
/        \
/          \
/            \
'+'            '/'
/\              /\
/  \            /  \
/    \          /    \
/      \        /      \
'*'   '-'        '+'     2
/\      /\       /\
/  \    /  \     /  \
/    \  /    \   /    \
5    2  '*'   7   3    4
/ \
3   4```
postfix expression of above tree:

5 2 * 3 4 * 7 - + 3 4 + 2 / /

Is this right??

The tree you have now is for...
(3 + 4) / 2
The 3 + 4 is being evaluated, and it's result is divided by the 2. Because / has higher precedence than +, you need to add 3 to the division of 4 / 2...

5. buggers....
I think this is confusing sometimes.

okay so the correct tree expression of
(5*2+(3*4-7))/(3+4/2)
is:

Code:
```                                    '/'
/    \
/      \
/        \
/          \
/            \
'+'            '+'
/\              /\
/  \            /  \
/    \          /    \
/      \        /      \
'*'   '-'        3     '/'
/\      /\             / \
/  \    /  \           /   \
/    \  /    \         /     \
5    2  '*'   7        4      2
/ \
3   4```