#include <stdio.

h>
#include <stdlib.h>
struct node
{
int data;
int left;
int right;
};
void cal_binarytree(struct node **start, int data)
{
struct node *temp=NULL;
temp=(struct node *)malloc(sizeof(struct node));
temp->data=data;
temp->left=NULL;
temp->right=NULL;

struct node *curr;
curr=*start;
if(*start==NULL)
{
*start=temp;

}
else
{
while(15)
{
if(data > curr->data)
{
if(curr->right==NULL)
{curr->right=temp;
break;}
else
{
curr=curr->right;

}

}
else
{ if(curr->left==NULL)
{
curr->left=temp;
break;}
else
{
curr=curr->left;
}
}

}
curr=temp;
}

}
void search(int vts, struct node **start)

for(i=0. } else { while(temp!=NULL) { if(vts > temp->data) {if(temp->right==NULL) break. else printf("Value found at internal"). } } } printf("Value not found"). scanf("%d". int i. } if(vts==temp->data) { if(temp->right==NULL && temp->left ==NULL) printf("value found at leaf"). return. else break. else { temp=temp->right. int size. . } else if(vts==(*start)->data) { printf("Value found at start"). temp=*start. return. system("pause") or input loop */ int main(int argc. if(*start==NULL) {printf("The tree is empty"). } /* run this program using the console pauser or add your own getch. return. i++) { int input. } } else {if(temp->left!=NULL) temp=temp->left. char *argv[]) { struct node *start=NULL. i<size. printf("Enter the no of elements you want to enter\n").{ struct node *temp=NULL.&size).

search(vts.&start). input). scanf("\n%d".&vts). cal_binarytree(&start.&input). scanf("%d". return 0. } . } printf("Enter the element to search in tree\n"). int vts=0.