InterviewSolution
Saved Bookmarks
| 1. |
Which of the following properties are obeyed by all three tree – traversals?(a) Left subtrees are visited before right subtrees(b) Right subtrees are visited before left subtrees(c) Root node is visited before left subtree(d) Root node is visited before right subtreeMy question is from Binary Trees topic in chapter Binary Trees of Data Structures & Algorithms IThis question was addressed to me during an online exam. |
|
Answer» RIGHT ANSWER is (a) Left subtrees are visited before right subtrees Best explanation: In preorder, INORDER and postorder traversal the left subtrees are visited before the right subtrees. In Inorder traversal, the Left subtree is visited first then the Root NODE then the Right subtree. In postorder traversal, the Left subtree is visited first, then Right subtree and then the Root node is visited. |
|