edited by
323 views
1 votes
1 votes

Suppose that six keys are inserted into an unbalanced binary search tree in the following order: $4, 6, 3, 8, 2$, and $5$.

Then which of the following statements is/are correct statement?

  1. Finding a key in the resulting tree requires examining $1, 2$, or $3$ nodes.
  2. The resulting tree has equal numbers of interior and leaf nodes.
  3. The key $7$ can now be inserted without adding another level to the tree.
  1. I and II only
  2. I and III only
  3. II and III only
  4. I, II, and III
edited by

1 Answer

Best answer
1 votes
1 votes
The resulting tree looks like below tree :

   4

  /  \

 3    6

/     /   \

2   5     8

 

 

 

Finding 4 now takes one comparison (with the root), finding 3 and 6 take two comparisons, and finding the other nodes takes three comparisons. Hence option I is correct .

There are three leaf nodes and three interior nodes. Option II is correct .

If 7 is inserted, it will go onto a new level, as the left child of 8. This makes option III false .
selected by
Answer:

Related questions

2 votes
2 votes
2 answers
4