GeekInterview.com
  I am new, Sign me up!
 
GeekInterview.com  >  Placement Papers  >  Adobe  >  Placement Papers
Go To First  |  Previous Question  |  Next Question 
 Placement Papers  |  Question 7 of 10    Print  
how will you find the number of leaf nodes in a tree

  
Total Answers and Comments: 2 Last Update: October 02, 2009     Asked by: hari 
  
 Sponsored Links

 
 Best Rated Answer

No best answer available. Please pick the good answer available or submit your answer.
November 15, 2006 11:56:43   #1  
Atul Mehra        

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

}


 
Is this answer useful? Yes | NoAnswer is useful 0   Answer is not useful 2Overall Rating: -2    
October 02, 2009 17:01:34   #2  
shashankjo Member Since: October 2009   Contribution: 1    

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

int count 0; // global variable

int inorder(NODE *root)
{
if(root! NULL)
{
inorder(root->left);
if(root->left NULL && root->right NULL)
count++;
inorder(root->right);
}
return (count);
}

 
Is this answer useful? Yes | No

 Related Questions

Latest Answer : Here is the algorithm that works well and takes O(log n) time.Algorithm Exponientiate(x,n)//computes x^n  for an integer n>=0{      m:= n;    power:=1;    z:=x;    while( ( m mod ...

1. find the nth node from end in a linked list in single parse2. wap to check if the tree is BST3. prove A+BC =(A+B)(A+C)4. (A023AC5B)-(129B5321) to the base 135. prove that no of leaf nodes in any binaryy tree is one more than the no of nodes with degree 26. write a prog in assembly lang 2 calculate sum of first n natural nos7. print values in an array with recurring diditseg a[10]={3,2,5,4,3,4,6,12,4,12,6}the prog shud print {3,3,5,4,4,6,6,12,12}chk the sequence8. write prefix and postfix notation9.
Read Answers (6) | Asked by : Sumit

HI Everybody, I attended Adobe test on 16-07-2006. it was cool test. The test was 3 hours. I am sending u Questions Asked on Engineering and C. Merit-Trac conducted the test. The test was for both Developmnt & testing Domain. I attended for Dev posn. ADOBE Written Test1) Wap to reverse a linked list and sort the same.2) Given two integers A & B. Determine how many bits required to convert A to B. Write a function int BitSwapReqd(int A, int B);3) Write an algorithm to insert a node into
Read Answers (11) | Asked by : Guru Pradeep

Latest Answer :      int count=0;     // global variable int inorder(NODE *root)  {       if(root!=NULL)       {         inorder(root->left);         ...
Read Answers (2) | Asked by : hari

Most of the problems in adobe are solved here, though it is not mentioned that they are from Adobe, so this means he has to go through them as many as possibleThe C/Java/quant are from bestsamplequestions.comThe 
Latest Answer : Hi,I am preparing for Adobe, I am concentrating more on Data-structure and my C++ skills. I am ready to put my 100% effort but lacking direction. Can anybody please guide me some good books and links to follow for this preprations? I appriciate ...
Read Answers (2) | Asked by : Chirag

Test has been made simple than before.Few easy questions on output of programs.1. int arr[10]; //in file1.cextern int *arr; //in file2.cmain(){ arr[0]=1;}//Find Error? how and why2.Hash 
View Question | Asked by : pardeepg

There were 4 sectionsDS 10 ds quesionsJava/J2EE 15 java questions+ 5 j2eeAnalyticalQuantaSome of the questions I remember1) a bst was give and asked the forth smallest element (easy one)2)an inorder of 
View Question | Asked by : richakharya


 Sponsored Links

 
Related Articles

Tree Topology

Tree Topology Among all the Network Topologies we can derive that the Tree Topology is a combination of the bus and the Star Topology The tree like structure allows you to have many servers on the network and you can branch out the network in many ways This is particularly helpful for colleges unive
 

What is B-Tree

B-Tree is an indexing technique most commonly used in databases and file systems where pointers to data are placed in a balance tree structure so that all references to any data can be accessed in an equal time frame. It is also a tree data structure which keeps data sorted so that searching, insert
 

Tutorial 68: MSAS - Building a Relational Decision Tree Model

Let us assume FoodMart wants the members with Golden Membership to be studied It wants to focus on broadening the membership of the Gold Card This can be done now using the Decision Tree Model mosgoogle The Decision Tree model can be created from the relational data contained in the FoodMart 2000 Ac
 

About Us -  Privacy Policy -  Terms and Conditions -  Contact -  Ask Question -  Propose Category -  Site Updates 

Copyright © 2005 - 2009 GeekInterview.com. All Rights Reserved

Page copy protected against web site content infringement by Copyscape