in Unknown Category edited by
250 views
0 votes
0 votes

Suppose we have to insert the following sequence of keys into an empty binary search tree:

$\text{5, 7, 45, 60, 50, 23, 15, 54}$

What would be the height of binary search tree?

  1. $3$
  2. $4$
  3. $5$
  4. $6$
in Unknown Category edited by
by
250 views

1 Answer

0 votes
0 votes
Best answer

The height of the tree is the longest path from the root to any leaf node.

In BST insertion value less than the root goes to the left side and a value greater goes to the right side of the root.

Option $C$ and $D$ both are correct here.

NOTE 1) if the root node is at hight=0 then the height of the tree is $5$.

           2) If the root node is at hight=1 then the height of the tree is $6$. 

BST simulator

selected by

2 Comments

root height =0 or 1 ?

as per me, there is no standard reference for it. So option D also correct.
0
0

  yes, you can take. both options are correct.

2
2

Related questions