Which of the following properties are obeyed by all three tree – traversals?

Ngọc Trâm

New member
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
 
Answer: a
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.
 

Tìm kiếm

Back
Top