Solve a problem in binary search tree