pre order: A B D E G H C F in -order: D B G E H A C F
Question
pre order: A B D E G H C F in -order: D B G E H A C F
Solution
It seems like you're asking for the post-order traversal of a binary tree given the pre-order and in-order traversals. Here's how you can do it:
- The first element of the pre-order traversal (A) is the root of the tree.
- In the in-order traversal, the elements to the left of the root (D B G E H) are in the left subtree, and the elements to the right of the root (C F) are in the right subtree.
- Repeat the process for each subtree. For the left subtree, B is the root, D is to its left, and G E H are to its right. For the right subtree, C is the root and F is to its right.
- Continue this process until each subtree only has one element.
- The post-order traversal is obtained by visiting the left subtree, then the right subtree, and finally the root.
So, the post-order traversal of the given binary tree is: D H G E B F C A.
Similar Questions
In order:E,C,B,Y,Z,G,D, Preorder:B,C,E,G,Y,Z,D
Identify the correct sequential order of existence from the following.(1 Point)Physical order >> Bio order >> Animal order >> Human orderAnimal order >> Human order >> Physical order >> Bio orderBio order >> Animal order >> Human order >> Physical orderHuman order >> Bio order >> Animal order >> Physical order
Arrange following in decreasing order of C–H bond energy order ?A a > b > c > d B b > d > c > a C b > d > a > c D c > a > d > b
The inorder and preorder traversal of a binary tree are Inorder: d b e a p q r PreOrder: a b d e q p r The postorder traversal of the binary tree is: (A) d e b p r q a (B) e d b r p q a (C) e d b p r q a (D) d e p r b q a
Complete below code of Preorder traversalPreorder(node* root){If(a-----------------){cout<<root->data;b--------------------------;preorder(root->right);}} a.NULL b.root->lefta.root==NULL b.Preorder(root->left);a.root!=NULL b.Preorder(root->left);a.root!=NULL b.root->left
Upgrade your grade with Knowee
Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.