Posts

Showing posts from November, 2019

COMPLETE BST PROGRAM.

Image
   BST PROGRAM! #include<conio .h> #include<stdio .h> struct node{ int data ; struct node *left; struct node *right; }; void preorder(struct node *root); //declare preorder for travsal void searching(struct node *root);// searching in binary tree void maximum(struct node *root);// find maximum in binary tree void minimum(struct node *root);//find minimum in binary tree void main() { struct node *root=NULL,*temp,*current,*parent; int i,n,count; clrscr(); printf("enter the number of nodes in bst\n"); scanf("%d",&n); for(i=0;i { temp=(struct node *)malloc(sizeof(struct node)); scanf("%d",&temp->data); temp->left=NULL; temp->right=NULL; if(root==NULL) {   root=temp; } else {    current=root;    while(current!=NULL)    {       parent=current;       if(temp->data > current->data)       current=current->right;       else       current=current->left;    }    if(parent->data >temp-&g