Closest Nodes Queries in a Binary Search Tree
Read the tree values in sorted order, then binary search for the largest value at most each query and the smallest value at least it.
Read the tree values in sorted order, then binary search for the largest value at most each query and the smallest value at least it.