540 Programming and Data Structures
prepr->ls;
else
pr*pr->rs;
}
* 1- 0;
* p - p s j
return 0;
I
insert (int ele)
{ struct nodes *t,*father,*m _loc;
search (ele, &fathar,&m_loc);
i f (m_locl«0)
{
printf ("Item already present”) ;
return 0;
}
t* (struct nodes * )malloc (sizeof (struct nodes));
t->data*ele;
t->ls«0;
tj->rs»0;
if(father»=0)
tree-t;
if(ele<father-xiata)
father->ls®t;
else
father->rs*=t;
return 0;
del (int ele)
{
int a (struct nodes*, struct nodes*);
int b(struct nodes*, struct nodes*);
int c (struct nodes*,struct nodes*);
struct nodes * father, *mloc ;
i f (tree»*0)
{
printf ("Tree is empty");
return 0;
}
search (ele, fcfather, &m loc) ;