判断给定的二叉树是否是二叉排序树
void JudegBST(BSTree &T){ Queue q; BSTree bst; int flag=1; q.front=-1; q.rear=-1; q.a[++q.rear]=T; while(q.front<q.rear){ bst=q.a[++q.front]; if(bst->lchild){ if(bst->lchild->data<=bst->data){ q.a[++q.rear]=bst->lchild; } else{flag=0;break;} } if(bst->rchild){ if(bst->rchild->data>=bst->data){ q.a[++q.rear]=bst->rchild; } else{flag=0;break;} } } if(flag==0){printf("不是二叉排序树\n");} else{printf("是二叉排序树\n");} }