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);
}
}

7 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

Unknown said...

nice coading..
good job.
Students Portal

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

Unknown said...

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

youtubecomactivate said...

We have to know the methods you can easy way to Activate YouTube doing YouTube.com/activate. If you are facing issues with YouTube, like how to connect YouTube on your TV, mobile or other devices contact us. Google has provided us the enjoyment, and by YouTube activate, you watch here latest videos, songs, or web series, etc.