BINARY SEARCH TREE CREATION THROUGH C
#include<stdio.h> #include<stdlib.h> struct tree { int data; struct tree *left; struct tree *right; }; int pre(struct tree *root) { if(root!=NULL) { printf("%d ",root->data); pre(root->left); pre(root->right); } } struct tree *Insert_node(struct tree *root) { struct tree *temp,*ptr,*prev=NULL; temp=(struct tree *)malloc(sizeof(tree)); int n; printf("enter data"); scanf("%d",&n); temp->data=n; temp->left=NULL; temp->right=NULL; if(root==NULL) { root=temp; } else { ptr=root; while(ptr!=NULL) { prev=ptr; if(ptr->data>temp->data) { ptr=ptr->left; } else if(ptr->data<temp->data) { ptr=ptr->right; } else if(ptr->data==temp->data) { printf("dup...