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 does malloc () calloc () realloc () free () do?
Explain what is page thrashing?
why use functions a) writing functions avoids rewriting the same code over and over b) using functions it becomes easier to write programs and keep track of what they are doing c) a & b d) none of the above
write a program that declares an array of 30 elements named "income" in the main functions. then cal and pass the array to a programmer-defined function named "getIncome" within the "getIncome" function, ask the user for annual income of 30 employees. then calculate and print total income on the screen using the following function: "void getIncome ( ai []);
Explain is it better to use a pointer to navigate an array of values, or is it better to use a subscripted array name?
How to write a code for reverse of string without using string functions?
What are Macros? What are its advantages and disadvantages?
Explain how can I write functions that take a variable number of arguments?
How can I remove the leading spaces from a string?
Write a program to compute the similarity between two strings - The program should get the two strings as input - Then it will output one single number which is the percentage of similarity between the two strings
What is sorting in c plus plus?
What does emoji p mean?
Tell us something about keyword 'auto'.
write a program to generate address labels using structures?
What are the similarities between c and c++?