Depth of a key in a BST

You insert the keys 8,3,10,1,6,14,4,7,138, 3, 10, 1, 6, 14, 4, 7, 13 in that order into an initially empty binary search tree (each key walks down from the root, going left if smaller and right if larger, until it hits an empty spot). At what depth does key 77 end up? (The root is at depth 00.)

Show hints (2)+
  1. Insert in the given order; each key walks left/right until an empty slot.
  2. Trace 77's path from the root: 83678 \to 3 \to 6 \to 7.

Answer

Reveal answer →

3

Want the full step-by-step worked solution? It's part of Premium - along with a worked solution for every question in the bank.

Asked at: Probability & Market-Making, Game-Based Aptitude

Related questions