In order: “INFORMATION”
Post Oder: “INOFMAINOTR”
steps to follow:
- mark the last element of the post order result as it is the root element.
- Mark the root element in inorder result.
- Root element will divide the inorder result into left subtree and right subtree.
- Draw the tree
- Repeat the steps till you get the binary tree.
First mark the root element. The root element is always the last element in the POST ORDER sequence. In this case, it is R.
Now, mark R as root in the INORDER sequence, once you do that you will get the left subtree and right subtree.
In order: INFORMATION (left sub tree-> INFO & right subtree -> MATION)
Post order: INOFMAINOTR
// constructing binary tree