GeekInterview.com
  I am new, Sign me up!
 
GeekInterview.com  >  Placement Papers  >  Integra  >  Aptitude
Go To First  |  Previous Question  |  Next Question 
 Aptitude  |  Question 12 of 21    Print  
For a binary tree with n nodes, how many nodes are there which has got both a parent and a child?


  
Total Answers and Comments: 1 Last Update: May 09, 2006   
  
 Sponsored Links

 
 Best Rated Answer

No best answer available. Please pick the good answer available or submit your answer.
May 09, 2006 03:15:55   #1  
Subrata Nath        

RE: For a binary tree with n nodes, how many nodes ar...

Ans -

There are total n nodes . Here out of the n nodes except the leaves and root all the others have both the child and parent . Let us assume that the heigh of the binary tree is h.

Then h log n ( Base 2) .[ floor value ] .

No of leaves 2^log n (base 2 ).

Hence the no of nodes having both the parent and child is

n-2^log n (base 2 ) -1


 
Is this answer useful? Yes | No

 Related Questions

Latest Answer : Ans - There are total n nodes . Here out of the n nodes except the leaves and root ,all the others have both the child and parent . Let us assume that the heigh of the binary tree is h.Then h = log n ( Base 2) .[ floor value ] .No of leaves = 2^log n ...


 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
 

Sponsored Links

 
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