Data Structures | Binary Search Trees | Question 10

Which of the following traversals is sufficient to construct BST from given traversals
1) Inorder
2) Preorder
3) Postorder
(A) Any one of the given three traversals is sufficient
(B) Either 2 or 3 is sufficient
(C) 2 and 3
(D) 1 and 3

Answer: (B)

Explanation: When we know either preorder or postorder traversal, we can construct the BST. Note that we can always sort the given traversal and get the inorder traversal. Inorder traversal of BST is always sorted.

Quiz of this Question

My Personal Notes arrow_drop_up