INSERTIONSORT26
INSERTIONSORT26
#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
int data;
struct bstnode*left,*right;
}bstnode*inti()
return NULL;
if(T==NULL)
bstnode*r=(bstnode*)malloc(sizeof(bstnode));
r->data=x;
r->left=NULL;
r->right=NULL;
return r;
if(x>T->data)
T->right=insert(T->right,x);
else
if(x<T->data)
T->left=insert(T->left,x);
}
return T;
bstnode*create()
int n,x,i;
bstnode*root=NULL;
scanf("%d",&n);
for(i=0;i<n;i++)
scanf("%d",&x);
root=insert(root,x);
return root;
void inorder(bstnode*T)
if(T!=NULL)
inorder(T->left);
printf("%d\t",T->data);
inorder(T->right);
void preorder(bstnode*T)
if(T!=NULL)
printf("%d\t",T->data);
preorder(T->left);
preorder(T->right);
void postorder(bstnode*T)
if(T!=NULL)
postorder(T->left);
postorder(T->right);
printf("%d\t",T->data);
void main()
bstnode*root=NULL;
int x;
clrscr();
root=create();
scanf("%d",&x);
root=insert(root,x);
inorder(root);
preorder(root);
postorder(root);
getch();
}