# Thread: Could somebody check my binary tree?

1. Member
Join Date
Oct 2011
Posts
30
Rep Power
0

## Could somebody check my binary tree?

could somebody please tell me what (A*B) / (C^D^E) is in POST ORDER.

I drew the tree and went back over it in post order

Java Code:
```        /
*      ^
A  B   C   ^
D  E```
From this I get :

AB*C/D^E^, is this correct?

2. ## Re: Could somebody check my binary tree?

First off, define exactly what you mean by post order.

I might point out that AB*C/D^E^ isn't a valid expression.

3. Senior Member
Join Date
Oct 2010
Location
Germany
Posts
787
Rep Power
8

## Re: Could somebody check my binary tree?

Tree traversal - Wikipedia, the free encyclopedia

To traverse a non-empty binary tree in postorder, perform the following operations recursively at each node[1]:
Traverse the left subtree.
Traverse the right subtree.
Visit the root.

@Kevin: I think the "right" postorder traversation will generate a non "valid expression" too....
Last edited by eRaaaa; 11-28-2012 at 08:18 PM.

4. ## Re: Could somebody check my binary tree?

Originally Posted by eRaaaa
@Kevin: I think the "right" postorder traversation will generate a non "valid expression" too....
Good point!

5. ## Re: Could somebody check my binary tree?

The correct postfix expression (according to your tree) is: AB*CDE^^/

kind regards,

Jos

6. ## Re: Could somebody check my binary tree?

Originally Posted by KevinWorkman
I might point out that AB*C/D^E^ isn't a valid expression.
Yes it is: it has five operands and four binary operators and the evaluation stack is never empty in between ...

kind regards,

Jos

7. Member
Join Date
Oct 2011
Posts
30
Rep Power
0

## Re: Could somebody check my binary tree?

Thank you very much

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•