Data Structures · Question 27 · Hard

A binary tree has preorder traversal A B D E H C F G and inorder traversal D B H E A C G F. What is its postorder traversal?

  1. H D E B G F C A
  2. D E H B G F C A
  3. D H E B F G C A
  4. D H E B G F C A
Answer and explanation

Answer: D. D H E B G F C A

Explanation: A is the root; left subtree inorder is D B H E and right is C G F. In the left part, B has left child D and right child E, and E has left child H. In the right part, C has right child F, and F has left child G. Postorder gives D H E B G F C A.

Previous: An array-based binary min-heap holds [2, 5, 3, 9, 6, 4, 8]. One deleteMin… · Next: The keys 10, 20, 30, 25, 28 are inserted in that order into an empty AVL tree…

Practise data structures

Try a fresh set of data structures questions with an explanation after every answer, free and without signing up: Data Structures practice. Or sit a full placement mock test.

More data structures questions

More technical & programming practice

Algorithms · Object-Oriented Programming · DBMS · SQL · Operating Systems · Computer Networks · Software Engineering · Cloud & DevOps

LogicWiz Exams home · All practice topics · Placement mock tests · Daily 10 challenge