Answer the following questions from the diagram of a Binary Tree given below: Write the in-order…
Computer Science20233 marksShort answer
Answer the following questions from the diagram of a Binary Tree given below:
(a)[1.0]
Write the in-order traversal of the above tree structure.
(b)[1.0]
Name the children of the nodes B and G.
(c)[1.0]
State the root of the right sub tree.
Answer
Answer (a)
AI
From the figure: A is the root with children B (left) and F (right); B has left child D only; F has right child G only; G has children E (left) and H (right).
In-order (Left, Root, Right): D, B, A, F, E, G, H
Answer (b)
AI
Node B has only one child: D (its left child); B has no right child.
Node G has two children: E (left child) and H (right child).