Data Structures & AlgorithmsHardGATE CS · Product-company placement

A BST holds integer keys between 1 and 100. Which sequence CANNOT be the sequence of keys examined while searching for 44?

  1. A. 94, 77, 9, 57, 49, 44
  2. B. 38, 55, 48, 40, 44
  3. C. 24, 30, 74, 45, 44
  4. D. 37, 43, 99, 26, 48, 44

Correct answer: D. 37, 43, 99, 26, 48, 44

Each probe narrows an interval (lo, hi) that must contain 44; every later key must lie strictly inside it. In 37, 43, 99, 26, 48, 44 one key falls outside the interval already fixed by an earlier ancestor.

More Trees, Graphs, Recursion and Dynamic Programming questions

Exams that ask this topic