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
Explain what are preprocessor directives?
write a c program to print the next of a particular no without using the arithmetic operator or looping statements?
Explain how do you convert strings to numbers in c?
What are enumerated types?
Can we declare variable anywhere in c?
What is the size of enum in c?
Find MAXIMUM of three distinct integers using a single C statement
What is the argument of a function in c?
What is the purpose of the statement: strcat (S2, S1)?
What is the scope of static variables in c language?
What is difference between %d and %i in c?
What does main () mean in c?
Tell us bitwise shift operators?
Is it valid to address one element beyond the end of an array?
The number of measuring units from an arbitarary starting point in a record,area,or control block to some other point a) recording pointer b) offset c) branching d) none