Inorder and postorder traversal of a binary tree are given. In: E, I, C, F, B, G, D, J, H, K
Inorder and postorder traversal of a binary tree are given.
In: E, I, C, F, B, G, D, J, H, K
Post: I, E, F, C, G, J, K, H, D, B
What is the preorder traversal of the binary tree?
Show answerHide answer
Correct answer: (A) B, C, E, I, F, D, G, H, J, K
Explanation
The root is B (last in postorder). Left subtree {E,I,C,F} has root C, with E (right child I) and F. Right subtree {G,D,J,H,K} has root D, with left G and right H (J, K). Preorder: B, C, E, I, F, D, G, H, J, K.