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?
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.