i m trying to make a function which will calculate size of each node of an ordered statistic tree . here size refers to the number of nodes in left sub tree and right sub tree plus one...
but whenever i call this function compiler gives error....and program terminates at line:
if(ptr->lc==NULL && ptr->rc==NULL)
[code=c]
size(struct node *ptr)
{
if(root==NULL)
{
return 0;
}
if(ptr->lc==NULL && ptr->rc==NULL)
ptr->size=1;
if(ptr!=NULL)
ptr->size=(size(p tr->lc) + size(ptr->rc)+1);
}
[/code]
plz help out by advising me
but whenever i call this function compiler gives error....and program terminates at line:
if(ptr->lc==NULL && ptr->rc==NULL)
[code=c]
size(struct node *ptr)
{
if(root==NULL)
{
return 0;
}
if(ptr->lc==NULL && ptr->rc==NULL)
ptr->size=1;
if(ptr!=NULL)
ptr->size=(size(p tr->lc) + size(ptr->rc)+1);
}
[/code]
plz help out by advising me
Comment