validate binary search tree - generic