R
RAKHE
I have come accross with the code for finding Depth of tree, i am
not
getting this, please anyone throw a light on this ....
http://www.math.bas.bg/~nkirov/2010/NETB201/slides/ch06/pic3.jpg
please explain in code level rather than theoratical level.
int depth(treenode *p)
{
if(p==NULL)return(0);
if(p->left){h1=depth(p->left);}
if(p=>right){h2=depth(p->right);}
return(max(h1,h2)+1);
}
not
getting this, please anyone throw a light on this ....
http://www.math.bas.bg/~nkirov/2010/NETB201/slides/ch06/pic3.jpg
please explain in code level rather than theoratical level.
int depth(treenode *p)
{
if(p==NULL)return(0);
if(p->left){h1=depth(p->left);}
if(p=>right){h2=depth(p->right);}
return(max(h1,h2)+1);
}