+1 vote
in Data Structures & Algorithms I by (110k points)
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 subtree

My question is from Binary Trees topic in chapter Binary Trees of Data Structures & Algorithms I

This question was addressed to me during an online exam.

1 Answer

+1 vote
by (672k points)
selected by
 
Best 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.

Related questions

Welcome to TalkJarvis QnA, a question-answer community website for the people by the people. On TalkJarvis QnA you can ask your doubts, curiosity, questions and whatever going in your mind either related to studies or others. Experts and people from different fields will answer.

Categories

...