#include<iostream>
using namespace std;
typedef int KeyType;
typedef struct BSTNode{
KeyType key;
struct BSTNode *lchild;
struct BSTNode *rchild;
}BSTNode,*BiTree;
int BST_Int(BiTree &T,KeyType k){
if(T==NULL){
T=(BiTree)malloc(sizeof(BSTNode));
T->key=k;
T->lchild=T->rchild=NULL;
return 1;
}else if(k==T->key){
return 0;//相同元素不插入
}else if(k<T->key){
return BST_Int(T->lchild,k);
}else{
return BST_Int(T->rchild,k);
}
}
void C_BST(BiTree &T,KeyType str[],int n){
T=NULL;
int i=0;
while(i<n){
BST_Int(T,str[i]);
i++;
}
}
BSTNode *BST_S(BiTree T,KeyType k,BiTree &p){
p=NULL;
while(T!=NULL&&k!=T->key){
p=T;
if(k<T->key){
T=T->lchild;
}else{
T=T