• edited by
11,083 views
46 46 votes

A Binary Search Tree (BST) stores values in the range $37$ to $573$. Consider the following sequence of keys.

  1. $81, 537, 102, 439, 285, 376, 305$
  2. $52, 97, 121, 195, 242, 381, 472$
  3. $142, 248, 520, 386, 345, 270, 307$
  4. $550, 149, 507, 395, 463, 402, 270$

Which of the following statements is TRUE?

  1. I, II and IV are inorder sequences of three different BSTs
  2. I is a preorder sequence of some BST with $439$ as the root
  3. II is an inorder sequence of some BST where $121$ is the root and $52$ is a leaf
  4. IV is a postorder sequence of some BST with $149$ as the root

3 Answers

Best answer
49 49 votes
  1. Incorrect because I & IV are not in ascending order.(Inoder sequence of BST is in increasing order)
     
  2. I is a preorder sequence of some BST with $439$ as the root . False because if $439$ is root, it should be first element in preorder.
     
  3. This is correct.
     
  4. IV is a postorder sequence of some BST with $149$ as the root, False because if $149$ is root, it should be last element in postorder
• edited by
14 14 votes
it should be C)

Inorder sequences are sorted. In preorder traversal root comes first and in postorder traversal root comes last.
Answer:
Position:
Show:

Related questions

45 45 votes
4 answers 4 answers
19.7k
19.7k views
Ishrat Jahan asked Oct 27, 2014
19,657 views
Which of the following is TRUE?The cost of searching an AVL tree is $\Theta (\log n)$ but that of a binary search tree is $O(n)$The cost of searching an AVL tree is $\The...
39 39 votes
4 answers 4 answers
19.2k
19.2k views
Ishrat Jahan asked Oct 29, 2014
19,209 views
How many distinct BSTs can be constructed with $3$ distinct keys?$4$$5$$6$$9$
78 78 votes
4 answers 4 answers
24.2k
24.2k views
Ishrat Jahan asked Oct 29, 2014
24,184 views
A Binary Search Tree (BST) stores values in the range $37$ to $573$. Consider the following sequence of keys.$81, 537, 102, 439, 285, 376, 305$$52, 97, 121, 195, 242, 381...
47 47 votes
3 answers 3 answers
11.8k
11.8k views
Ishrat Jahan asked Oct 28, 2014
11,807 views
Match the following flag bits used in the context of virtual memory management on the left side with the different purposes on the right side of the table below.$$\small ...