ALLInterview.com :: Home Page KalAajKal.com
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage  Contact Us     Login  |  Sign Up                      
tip   To Refer this Site to Your Friends   Click Here
Google
 
Categories  >>  Software  >>  Programming Languages  >>  C
 
 


 

 
 C interview questions  C Interview Questions
 C++ interview questions  C++ Interview Questions
 VC++ interview questions  VC++ Interview Questions
 Delphi interview questions  Delphi Interview Questions
 Programming Languages AllOther interview questions  Programming Languages AllOther Interview Questions
Question
Write code for finding depth of tree
 Question Submitted By :: Superhuman
I also faced this Question!!     Rank Answer Posted By  
 
  Re: Write code for finding depth of tree
Answer
# 1
/*
 * Simple tree node representation
  */
struct node_t {
  struct node_t *left;
  struct note_t *right;
};

/*
 * Return the maximum depth of the tree given a pointer
 * to its root node.
 */
unsigned int
tree_depth (node_t *root)
{
   return (NULL == root) ? 0 :
           MAX(tree_depth(root->left, root->right)+1);
}
 
Is This Answer Correct ?    0 Yes 2 No
Crispin
 

 
 
 
Other C Interview Questions
 
  Question Asked @ Answers
 
which will be first in c compiling ,linking or compiling ,debugging. Sonata3
C,c++, Java is all are structural oriented or procedure oriented language..?  3
How many types of linked lists what are they? How many types of data structures?  4
what is the stackpointer  2
what is the difference between malloc() and calloc() function?  1
how can i get output like this? 1 2 3 4 5 6 Excel3
which one of follwoing will read a character from keyboard and store in c a)c=getc() b)c=getchar() c)c=getchar(stdin) d)getc(&c) e)none  5
what is y value of the code if input x=10 y=5; if (x==10) else if(x==9) elae y=8; a.9 b.8 c.6 d.7 TCS2
program to find which character is occured more times in a string and how many times it has occured? for example in the sentence "i love india" the output should be i & 3.  3
What is the difference between static and global variables?  1
What is #pragma directive?how it is used in the program? what is its advantages and disadvantages?  1
How can I return multiple values from a function?  4
different between overloading and overriding  3
swap two integer variables without using a third temporary variable?  2
How to write a program for swapping two strings without using 3rd variable and without using string functions. iGate5
what is the advantage of using SEMAPHORES to ORDINARY VARIABLES??? NSN1
how memory store byte Huawei3
how to print value of e(exp1)up to required no of digits after decimal?  1
WAP – represent a char in binary format Motorola4
Function to find the given number is a power of 2 or not? Motorola12
 
For more C Interview Questions Click Here 
 
 
 
 
 
   
Copyright Policy  |  Terms of Service  |  Help  |  Site Map 1  |  Articles  |  Site Map  |   Site Map  |  Contact Us interview questions urls   External Links 
   
Copyright © 2007  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  Forum9.com   ::  KalAajKal.com