For the binary tree with root a; children of a as b and e; children of b as c…
1996
For the binary tree with root a; children of a as b and e; children of b as c and d; left child of e as f; and left child of c as g, which sequence is the post-order traversal?
- A.
f e g c d b a
- B.
g c b d a f e
- C.
g c d b f e a
- D.
f e d g c b a
Attempted by 44 students.
Show answer & explanation
Correct answer: C
Post-order traversal visits left subtree, then right subtree, then root. For the subtree rooted at b, the left subtree rooted at c gives g c, then the right child d is visited, and then b is visited, giving g c d b. For the subtree rooted at e, we visit f and then e, giving f e. Finally, the root a is visited. Thus the post-order traversal is g c d b f e a, so option 3 is correct.