Refer to the Binary Tree given below and answer the questions that follow: Write the post-order…
Computer Science20253 marksShort answer
Refer to the Binary Tree given below and answer the questions that follow:
(a)[1.0]
Write the post-order traversal of the above tree structure.
(b)[1.0]
Name the internal nodes of the right subtree and the external nodes of the left subtree
(c)[1.0]
Write the size of the tree and the degree of node D.
Answer
Answer (a)
AI
Post-order traversal (Left, Right, Root) of the entire tree: A, C, E, D, B, H, I, G, F
Answer (b)
AI
Right subtree (rooted at G): its nodes are G, I, H. Its internal nodes (nodes having at least one child) are G and I.
Left subtree (rooted at B): its nodes are B, A, D, C, E. Its external/leaf nodes (nodes with no children) are A, C and E.
Answer (c)
AI
Size of the tree (total number of nodes) = 9 (F, B, G, A, D, I, C, E, H).
Degree of node D (number of children of D) = 2 (children C and E).