Test a binary-search-tree probe sequence
Binary Search & Balanced Trees


Answer & solution
Answer: Impossible (no official key was published)
A search path obeys every ancestor constraint, not merely the immediately preceding comparison. Maintain an open interval of permissible keys, initially (−∞,+∞). When a probe is below 43, searching right raises the lower bound to that probe. When a probe is above 43, searching left lowers the upper bound.
After 61, every later probe must lie in (−∞,61).
After 52, every later probe must lie in (−∞,52).
After 14, every later probe must lie in (14,52).
After 17, every later probe must lie in (17,52).
After 40, every later probe must lie in (40,52).
The final probe is 43, so the search succeeds.
All probes meet the bounds. A witnessing BST can be built as a chain with these keys, taking the left or right child according to each comparison with 43. Thus the bound test proves existence, rather than just failing to find an error.
With 17 the sequence is valid. With 11 it is invalid, because after visiting 14 the search for 43 must stay in the right subtree of 14, whose keys exceed 14. The 11 variant therefore has the opposite answer.







