Question 17Asked in DSSSB TGT Computer Science (Technical), 1 Aug 2021, Shift 3

Consider the following New-order strategy for traversing a binary tree.

Consider the following New-order strategy for traversing a binary tree. I. Visit the right subtree of node using new-order II. Visit the left subtree of node using new-order III. Visit the node Tree: root A has left child B and right child E. B has right child C; C has left child D. E has left child F and right child I; F has children G (left) and H (right); I has right child J; J has right child K. What is the new-order traversal of the given tree?
  1. AK, J, I, H, G, F, E, D, C, B, A
  2. BA, B, C, D, E, F, G, H, I, J, K
  3. CB, D, C, A, G, F, H, E, I, J, K
  4. DA, B, C, D, K, J, I, H, G, F, E
Show answerHide answer

Correct answer: (A) K, J, I, H, G, F, E, D, C, B, A

Explanation

Right-left-node is the exact reverse of preorder (node-left-right). The preorder is A, B, C, D, E, F, G, H, I, J, K, so the new-order is K, J, I, H, G, F, E, D, C, B, A.

From DSSSB TGT Computer Science PYQ (Technical), 1 Aug 2021, Shift 3

This is question 17 of DSSSB TGT Computer Science PYQ (Technical), 1 Aug 2021, Shift 3. 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.