Data Structures & AlgorithmsHardGATE CS · TCS NQT · Product Company SDE

Keys 47, 48, 97, 84, 52, 82, 34, 75 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. 6
  2. B. 8
  3. C. 7
  4. D. 5

Correct answer: A. 6

Insert in order (root 47); counting edges on the deepest path gives height 6. Counting nodes instead of edges would give 7.

More Trees, Graphs, Recursion and Dynamic Programming questions

Exams that ask this topic