A binary search tree is built by inserting 40, 25, 60, 10, 30, 55, 70, 5 in that order. What is its postorder traversal?
Correct answer A. 5, 10, 30, 25, 55, 70, 60, 40
Explanation
The root is 40; its left subtree is 25 with children 10 and 30, and 5 is the left child of 10; its right subtree is 60 with children 55 and 70. Postorder visits left subtree, right subtree, then the node, so the left side yields 5, 10, 30, 25, the right side 55, 70, 60, and the root 40 comes last.
Answer checked How we write and check questions
Discussion