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