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
What is a null pointer in c?
What does do in c?
How is a pointer variable declared?
write a program that reads lines(using getline), converts each line to an integer using atoi, and computes the average of all the numbers read. also compute the standard deviation.
Explain how do you sort filenames in a directory?
What is actual argument?
How can type-insensitive macros be created?
Is c procedural or object oriented?
Explain how can I avoid the abort, retry, fail messages?
What is the usage of the pointer in c?
What is printf () in c?
What is class and object in c?
Is there any algorithm to search a string in link list in the minimum time?(please do not suggest the usual method of traversing the link list)
What is wrong with this statement? Myname = 'robin';
What is floating point constants?