Wednesday, August 15, 2007

Write a C program to compute the maximum depth in a tree?

int maxDepth(struct node* node)
{
if (node==NULL)
{
return(0);
}
else
{
int leftDepth = maxDepth(node->left);
int rightDepth = maxDepth(node->right);
if (leftDepth > rightDepth) return(leftDepth+1);
else return(rightDepth+1);
}
}

8 comments:

Shashank said...

Hi Vijay,
Thanks for posting such a good questions and answers.

Anonymous said...

wwegtfwegw w w3

Myers Briggs type indicator Hunter said...

Nice information you tell us , i also tell you some question ask during the interview
Questions
What are the challenging facets of the job?
What are the challenging facets of the job?
How would you describe your organization's personality and management style?
Describe the work environment.
How will that help the organization?
Myers Briggs type indicator Hunter

sandeep kumar said...

nice coading..
good job.
Students Portal

sandeep kumar said...

Thanks for the info. It is very helpful.
RegardsEducational site
Get jobs info at Educational site

Anonymous said...

Hi just stumbled upon your website via Yahoo after I typed in, "Blogger: Interview Questions" or perhaps something similar
(can't quite remember exactly). Anyways, I'm relieved I found it
because your subject material is exactly what I'm searching for (writing a university paper) and I hope you don't mind if I gather some material from here and I will
of course credit you as the reference. Thank you.



Feel free to visit my blog: computer

Vijay Sharma said...

Excellent information about INTERVIEW it can be very useful for freshers..
Stock future tips

Lo Lo said...

Jordan UniversityJordan UniversityJordan UniversityJordan UniversityJordan UniversityJordan UniversityJordan UniversityJordan UniversityJordan UniversityJordan UniversityJordan UniversityJordan UniversityJordan UniversityJordan UniversityJordan UniversityJordan UniversityJordan UniversityJordan UniversityJordan UniversityJordan UniversityJordan UniversityJordan UniversityJordan UniversityJordan UniversityJordan UniversityJordan UniversityJordan UniversityJordan UniversityJordan UniversityJordan UniversityJordan UniversityJordan UniversityJordan UniversityJordan UniversityJordan UniversityJordan UniversityJordan UniversityJordan UniversityJordan UniversityJordan UniversityJordan UniversityJordan UniversityJordan UniversityJordan UniversityJordan UniversityJordan UniversityJordan UniversityJordan UniversityJordan UniversityJordan University
http://www.ju.edu.jo/home.aspx
Jordan University
[url]http://www.ju.edu.jo[/url]