Answer the following questions from the diagram of a Binary Tree given below: Name the external…
Computer Science20243 marksShort answer
Answer the following questions from the diagram of a Binary Tree given below:
(a)[1.0]
Name the external nodes of the right sub tree.
(b)[1.0]
State the size and depth of the tree.
(c)[1.0]
Write the post-order traversal of the above tree structure.
Answer
Answer (a)
AI
The right subtree of the tree is rooted at F and contains the nodes F, G, E, H. Its external (leaf) nodes are E and H (F has child G, and G has children E and H, so only E and H have no children).
Answer (b)
AI
Size of the tree (total number of nodes) = 7 (nodes A, B, D, F, G, E, H).
Depth of the tree (number of edges on the longest root-to-leaf path) = 3 (e.g. A -> F -> G -> E, or A -> F -> G -> H).
Answer (c)
AI
Post-order traversal (Left, Right, Root) of the tree: D B E H G F A