判断二叉排序树
- 采用二叉排序树的特征性质进行求解
- 中序遍历二叉排序树为有序数组,为递增,不存在相等的情况
bool isSortTree(Tree root){
static int min =-1000;
if(root==NULL){
return true;
}
if(root.left!=null){进行递归求左子树
if(root.data<=min){return false;}
root.data=min;
if(root.right!=null){递归右子树
}
return true;