Correct option is B
We need to construct the
Binary Search Tree (BST) by inserting the elements in the given order:
40, 60, 50, 37, 52, 15, 8, 22
Recall the BST rule:
· Smaller value →
left subtree
· Greater value →
right subtree
Step 1: Construct the BST
Insert
40 first, so it becomes the root.
· 60 > 40 → right of 40
· 50 > 40 but 50 < 60 → left of 60
· 37 < 40 → left of 40
· 52 > 40, < 60, > 50 → right of 50
· 15 < 40, < 37 → left of 37
· 8 < 40, < 37, < 15 → left of 15
· 22 < 40, < 37, > 15 → right of 15
The resulting BST is:
Step 2: Determine the Height
The
height of a tree is normally defined as the number of
edges on the longest path from the root to a leaf.
The longest paths are:
40 → 37 → 15 → 8
and
40 → 37 → 15 → 22
Each contains
3 edges.
Therefore,
Height = 3
Important Note
If height is counted in terms of
number of levels/nodes rather than edges, the answer would be
4 levels. However, in standard data-structures terminology:
Height = number of edges in the longest root-to-leaf path
