hello all,
i am a beginner to data structures.I have created a recursive function for insertion of a node in BST,but the function is not working properly.....plz correct me,probably i am doing something wrong with the pointers
help required
.....urgent !!
the function is here---
void insert(struct node *head,int info)
{
struct node *temp=malloc(sizeof(struct node));
temp->data=info;
temp->rchild=NULL;
temp->lchild=NULL;
if(head==NULL)
head=temp;
else if(info>head->data)
{
insert(head->rchild,info);
}
else if(info<head->data)
{
insert(head->lchild,info);
}
}