Problem solving with programming: Building a binary tree using inorder and post/pre order traversals
Given the in-order, and pre-order or post-order sequences of a binary tree, how do we construct a binary tree from them?Given only pre-order and post order traversals, we can not construct a unique binary tree from them.
For example given
In-order : {1, 2, 3, 4, 5, 6, 7, 8}
Pre-order: {5, 3, 2, 1, 4, 8, 6, 7}
We have to create the following binary tree
Read full article from Problem solving with programming: Building a binary tree using inorder and post/pre order traversals
No comments:
Post a Comment