Data Structures · Question 12 · Hard

The preorder traversal of a Binary Search Tree is 50, 30, 20, 40, 70, 60, 80. What is its postorder traversal?

  1. 20, 30, 40, 50, 60, 70, 80
  2. 20, 40, 30, 50, 60, 80, 70
  3. 40, 20, 30, 80, 60, 70, 50
  4. 20, 40, 30, 60, 80, 70, 50
Answer and explanation

Answer: D. 20, 40, 30, 60, 80, 70, 50

Explanation: The root is 50; the left subtree is 30 with children 20 and 40; the right subtree is 70 with children 60 and 80. Postorder (left, right, root) gives 20, 40, 30, 60, 80, 70, 50.

Previous: Keys 15, 22, 8 and 29 are inserted in that order into an empty hash table of… · Next: The keys 10, 4, 7, 1 are inserted in that order into an empty array-based…

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