二叉排序树 建树
TreeNode* Insert(TreeNode* root,int x) {
if(root==NULL) {
root=new TreeNode(x);
}
if(x<root->data) {
root->leftchild=Insert(root->leftchild,x);
} else if(x>root->data) {
root->rightchild=Insert(root->rightchild,x);
}
return root;
}
if(root==NULL) {
root=new TreeNode(x);
}
if(x<root->data) {
root->leftchild=Insert(root->leftchild,x);
} else if(x>root->data) {
root->rightchild=Insert(root->rightchild,x);
}
return root;
}