Question 15Asked in DSSSB TGT Computer Science (Technical), 8 Aug 2021, Shift 2

Consider the following new-order strategy for traversing a given tree.

Consider the following new-order strategy for traversing a given tree. I. Visit the right subtree of a Node using new-order II. Visit the Node III. Visit the left subtree of a Node using new-order The tree: P is the root. P has left child Q and right child V. Q has left child R and right child S; S has left child T; T has right child U. V has left child W and right child Z; W has right child X; X has right child Y. What is the new-order traversal of the given tree?
  1. AZ, V, Y,X, W,P, S, U, T,Q, R
  2. BR, Q, T, U, S, P, W,X, Y, V, Z
  3. CP, W, X, Y, V,Z,R, Q, T, U, S
  4. DS, U, T,Q,R, Z, V, Y,X, W, P
Show answerHide answer

Correct answer: (A) Z, V, Y,X, W,P, S, U, T,Q, R

Explanation

This new-order is right, node, left, which is reverse in-order. The right subtree of P gives Z, V, Y, X, W. Then comes P. The left subtree gives S, U, T, Q, R.

From DSSSB TGT Computer Science PYQ (Technical), 8 Aug 2021, Shift 2

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