Considering the height of a binary tree as the number of edges between the…
2018
Considering the height of a binary tree as the number of edges between the tree's root and its furthest leaf, what is the height of the binary search tree created using the following key values (in order)?
19, 14, 18, 15, 16, 13, 12
- A.
3
- B.
4
- C.
5
- D.
6
Attempted by 197 students.
Show answer & explanation
Correct answer: B
First, insert the keys sequentially into a binary search tree starting with 19 as the root. Following standard BST rules, 14 becomes the left child of 19, and 18 becomes the right child of 14.
The longest path from root to leaf is 19-14-18-15-16. Counting the edges between these nodes gives a total of four edges. Therefore, the height of this binary search tree is 4.