Let T be a proper binary tree with 7 nodes abcdefg A preorde
Let T be a proper binary tree with 7 nodes: a,b,c,d,e,f,g.
A preorder traversal of T visits the nodes in this order: b,g,d,a,c,f,e. An inorder traversal of T visits the nodes in this order: d,g,c,a,f,b,e.
Which node is at distance 3 from the root of T? (Hint. In tree T, node a is the right child of node g.)
(A) a
(B) c
(C) d (E) e (F) g
Solution
Binary tree will look like this ---->
b
/ \\
g e
/ \\
d a
/ \\
c f
So node which is at distance 3 from the root of T---->c and f
Answer. (B) c
