The height of a binary search tree for the words banana, peach, apple, pear, coconut, mango and papaya using alphabetical order is :
Pick an option to check yourself, or open the answer below.
Show answer & explanation
Correct answer: C. 4
Explanation
Insert in order: banana (root), peach right, apple left, pear right of peach, coconut left of peach, mango right of coconut, papaya right of mango. The path banana–peach–coconut–mango–papaya has 4 edges, so the height is 4.
More Data Structures and Algorithms questions
- How much time does an algorithm using 2⁵⁰ bit operations need if each bit operation takes 2⁻³⁸ seconds?
- A lower-triangular sparse matrix is one :
- Arrange the following prefix expressions by value in increasing order: A. + − * 2 / 8 4 3 2 B. ↑ − * 3 3 * 4 2 5 C. + − ↑ 3 2 ↑ 2 3 / 6 − 4…
- Which of the following are true for a complete binary tree? A. It has always odd number of vertices. B. With i internal vertices, it has i+…
- Which of the following is TRUE?
- 2-3-4 trees are B - trees of order 4. They are isometric of trees.