Added function to check if a tree is a binary search tree