Question 845 – Operating-Systems
May 15, 2024Question 8929 – Graphs-and-Tree
May 15, 2024Question 10696 – Binary-Trees
A Binary Search Tree (BST) stores values in the range 37 to 573. Consider the following sequence of keys.
I. 81, 537, 102, 439, 285, 376, 305 II. 52, 97, 121, 195, 242, 381, 472 III. 142, 248, 520, 386, 345, 270, 307 IV. 550, 149, 507, 395, 463, 402, 270
Which of the following statements is TRUE?
Correct Answer: C
Question 28 Explanation:
A) Incorrect because I & IV are not in ascending order. (Inorder sequence of BST is in increasing order).
B) False because if 439 is root then it should be first element in preorder.
C) This is correct.
D) False because if 149 is root, then it should be last element in postorder.
B) False because if 439 is root then it should be first element in preorder.
C) This is correct.
D) False because if 149 is root, then it should be last element in postorder.
I, II and IV are inorder sequences of three different BSTs
I is a preorder sequence of some BST with 439 as the root
II is an inorder sequence of some BST where 121 is the root and 52 is a leaf
IV is a postorder sequence of some BST with 149 as the root
