problem 3, check for valid binary search tree