Question discussion

Consider the following new-order strategy for traversing a given tree.I. Visit the right subtree of a Node using new-orderII. Visit the Nod…

358611Medium DSSSB TGT Computer Science 0 replies 0 views
0
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
What is the new-order traversal of the given tree?

Figure for question 107

  • AZ, V, Y, X, W, P, S, U, T, Q, R
  • BS, U, T, Q, R, Z, V, Y, X, W, P
  • CR, Q, T, U, S, P, W, X, Y, V, Z
  • DP, W, X, Y, V, Z, R, Q, T, U, S
Correct answer: A

Explanation

In the new-order traversal, visit the right subtree, then the node, then the left subtree. For the root P, this gives Z, V, Y, X, W for the right side, then P, then S, U, T, Q, R for the left side.

Discussion 0

Nobody has replied yet. Start the discussion!