7

4

I know that In-order traversal(VISIT LEFT, VISIT ROOT, VISIT RIGHT) on a binary search tree gives me a sorted result. But I need to do a Post-order traversal (VISIT LEFT, VISIT RIGHT, VISIT ROOT) on a binary tree and the result should give me sorted values.

In order to achieve that, how should I construct my binary tree?

This'll work, but it won't necessarily lead to a balanced tree - some sort of balancing algorithm is needed. – Nick Johnson – 2010-02-08T10:00:22.970

Nice solution.. – bragboy – 2010-02-09T14:12:31.477