GeekInterview.com
   Home |  Tech FAQ  |   Interview Questions |  Placement Papers |  Tech Articles |  Learn |  Freelance Projects |  Online Testing |  Geeks Talk |  Job Postings |  Knowledge Base | Site Search |  Add/Ask Question

  GeekInterview.com  >  Placement Papers  >  Adobe  >  Placement Papers

 Print  |  
Question:  how will you find the number of leaf nodes in a tree



November 11, 2006 11:56:43 #1
 Atul Mehra   Member Since: Visitor    Total Comments: N/A 

RE: how will you find the number of leaf nodes in a tr...
 

FindLeafNodes(Tree *root)

{

 if (root->left == NULL && root->right == NULL)

   return 1;

else

 return (FindLeafNodes(root->left) + FindLeafNodes(root->right))

}

     

 

Back To Question