You are given a set $V$ of distinct integers. A binary search tree $T$ is created by inserting all elements of $V$ one by one, starting with an empty tree. The tree $T$ follows the convention that, at each node, all values stored in the left subtree of the node are smaller than the value stored at the node. You are not aware of the sequence in which these values were inserted into $T$, and you do not have access to $T$. Which one of the following statements is TRUE?
Inorder traversal of $T$ can be determined from $V$
Root node of $T$ can be determined from $V$
Preorder traversal of $T$ can be determined from $V$
Postorder traversal of $T$ can be determined from $V$
Correct answer: (A) Inorder traversal of $T$ can be determined from $V$
Explanation
Inorder traversal of a BST is always the sorted order of its keys, independent of insertion order. Root, preorder and postorder depend on insertion sequence.
More Trees and Binary Search Trees questions
GATE 2023 CS Q47– Consider the C function foo and the binary tree shown. When foo is called with a pointer…
GATE 2021 CS (CS1) Q20– A binary search tree T contains n distinct elements. What is the time complexity of…
GATE 2020 CS Q15– The preorder traversal of a binary search tree is 15, 10, 12, 11, 20, 18, 16, 19. Which…
GATE 2020 CS Q16– What is the worst case time complexity of inserting n2 elements into an AVL-tree with n…
GATE 2020 CS Q51– In a balanced binary search tree with n elements, what is the worst case time complexity…
GATE 2018 CS Q30– The postorder traversal of a binary tree is 8,9,6,7,4,5,2,3,1. The inorder traversal of…