Open In App

Algorithms Quiz | SP Contest 1 | Question 3

The Postorder traversal of a Binary Search Tree is {35, 30, 45, 40, 70, 85, 90, 80, 50}. What is its Preorder traversal?
(A) 50, 40, 30, 35, 45, 80, 70, 90, 85
(B) 50, 40, 45, 30, 35 ,80 , 90, 85, 70
(C) 50, 80, 90, 85, 70, 40, 45, 30, 35
(D) 30, 35, 40, 45, 50, 70, 80, 85, 90

Answer: (A)
Explanation: You may create a BST from it’s given post order traversal and then find it’s preorder traversal. Please refer to the post on Construct a Binary Search Tree from given postorder.
Quiz of this Question

Article Tags :