Question 79Asked in DSSSB PGT Computer Science (Technical), 11 Jul 2021

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?
  1. AB, C, E, I, F, D, G, H, J, K
  2. BB, F, I, E, C, D, G, H, J, K
  3. CB, C, E, I, F, D, G, H, K, J
  4. DB, C, E, F, G, H, K, D, J, I
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.

From DSSSB PGT Computer Science PYQ (Technical), 11 Jul 2021

This is question 79 of DSSSB PGT Computer Science PYQ (Technical), 11 Jul 2021. See all questions of this paper with answers, or attempt the paper as a timed online test to get your score and all-India rank.