Answer Posted / om
struct tree //creating structure
{
int data; //data field of node
struct tree *lchild,*rchild;//left child & right child of node
};
//for depth calculation
int depth(struct tree *p)
{
int l,r;
if(p!=NULL)
{
l=depth(p->lchild);
r=depth(p->rchild);
return (1+((l>r)?l:r));
}
return -1;
}
Is This Answer Correct ? | 6 Yes | 0 No |
Post New Answer View All Answers
why we wont use '&' sing in aceesing the string using scanf
How can you tell whether two strings are the same?
What are the complete rules for header file searching?
Some coders debug their programs by placing comment symbols on some codes instead of deleting it. How does this aid in debugging?
How can I make it pause before closing the program output window?
Explain how can I prevent another program from modifying part of a file that I am modifying?
Can a pointer point to null?
What kind of structure is a house?
What is #include cctype?
How can I sort a linked list?
Explain what is a program flowchart and explain how does it help in writing a program?
Give the rules for variable declaration?
What is the difference between %d and %i?
Define VARIABLE?
What is the return type of sizeof?