Answer the following questions based on the Binary Tree given below: Write the in-order traversal…
Computer Science20253 marksShort answer
Answer the following questions based on the Binary Tree given below:
(a)[1.0]
Write the in-order traversal of the right subtree.
(b)[1.0]
State the depth of the entire binary tree and depth of node E.
(c)[1.0]
Name the external nodes of the left subtree and internal nodes of the right subtree.
Answer
Answer (a)
AI
The right subtree is rooted at C, with F (left of C, children K and L) and G (right of C, child M); L's only child is N.
In-order traversal (Left, Root, Right) of the right subtree: $K, F, N, L, C, G, M$
Answer (b)
AI
Depth of the entire binary tree = 4 (root A at depth 0; deepest node N is reached via A-C-F-L-N, 4 edges from the root).
Depth of node E = 2 (A at depth 0 -> B at depth 1 -> E at depth 2).
Answer (c)
AI
External (leaf) nodes of the left subtree (rooted at B): E, I, J.
Internal nodes of the right subtree (rooted at C): C, F, G, L.