implemented isBinarySearchTree