Data Structures & AlgorithmsHardGATE CS · ICPC regional · Product Company SDE

Keys 37, 18, 57, 76, 72, 36, 64, 21 are inserted in this order into an empty BST. What is the height of the tree (edges on the longest root-to-leaf path)?

  1. A. 7
  2. B. 6
  3. C. 8
  4. D. 4

Correct answer: D. 4

Insert in order; the deepest leaf lies 4 edges below the root 37. (Counting nodes instead of edges gives 5.)

More Trees, Graphs, Recursion and Dynamic Programming questions

Exams that ask this topic