將節點插入二叉搜尋樹
struct tree{
int a;
tree* right;
tree* left;
};
tree* root=NULL;
void insert(tree*& in, int b){
if(in){
if(in->a<b)
insert(in->right,b);
else if(in->a>b)
insert(in->left,b);
else
cout<<"the value is already in the tree."<<endl;
}else{
tree* temp = new tree;
temp->a=b;
temp->right=NULL;
temp->left=NULL;
in=temp;
}
}