Question 1: Binary Trees. Given the postorder and inorder traversal of a binary tree, construct
the binary tree and output its preorder traversal. Then given two binary trees, determine whether
it is a subtree of the other binary tree. A subtree of a tree T is a tree consisting of a node in T and
all of its descendants in T. For example, the second tree is a subtree of the first tree.
Example Representing this tree:
Example Input/Output:
Question 1: Binary Trees. Given the postorder and inorder traversal of a binary tree, construct the binary tree and output its preorder traversal.Then given two binary trees,determine whether it is a subtree of the other binary tree. A subtree of a tree T is a tree consisting of a node in T and all of its descendants in T.For example, the second tree is a subtree of the first tree.
Example Representing this tree: 1
2
3
4567
Example Input/Output: