The height of a binary search tree built by inserting the words banana, peach, apple, pear, coconut, mango and papaya (in this order, alphabetical comparison) is:
Pick an option to check yourself, or open the answer below.
Show answer & explanation
Correct answer: C. 4
Explanation
banana is the root; peach goes right; apple left; pear right of peach; coconut left of peach; mango right of coconut; papaya (< peach, > mango) right of mango. The longest path banana-peach-coconut-mango-papaya has 4 edges.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 in increasing order of their values: A. + − * 2 / 8 4 3 2 B. ↑ − * 3 3 * 4 2 5 C. + − ↑ 3 2 ↑ 2 3…
- Which of the following are true for a complete (full) binary tree? A. It always has an odd number of vertices. B. With i internal vertices,…
- In a ______ the left and right subtrees of some node differ in height by more than one.
- FFTs are ______ techniques used to encode digital video and audio information and help analyse the signal in the ____ domain.