For a binary tree with n nodes, How many nodes are there
which has got both a parent and a child?



For a binary tree with n nodes, How many nodes are there which has got both a parent and a child?..

Answer / Preeti Rani

In a binary tree, every node except for the root node (if present) and leaf nodes (nodes without any children) have both a parent and a child. Therefore, in a binary tree with n nodes, the number of nodes that have both a parent and a child is n - number of leaves - 1.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Programming Languages AllOther Interview Questions

Write a program which inputs 2 integers representing the sides of a triangle, a and b. Next, write a function which accepts the 2 sides as parameters and returns the hypotenuse of the triangle, c. Use c 2 = a 2 + b 2 To raise a number to an exponent, us e the built - in JavaScript function Math.pow() Let’s say you have a variable x and you want to raise it to the 5 th power, use Math.pow in the following manner... Math.pow( x, 5 ); This will raise x to the 5 th power. To find the square root of a number, use t he built - in JavaScript function Math.sqrt () So to find the square root of x, use Math.pow () in the following manner... Math.sqrt( x ) You must create 2 functions to receive credit for this assignment. Your ‘ main ’ function which is called from the button. And your hypotenuse function. Again, the main function calls upon the hypotenuse f unction when it needs that value. Get the user ’ s input, call the function, output your result. Create your own CSS layout

0 Answers  


Difference between debugging, running, executing of an application

1 Answers   HCL,


How to find the aerry size

1 Answers   Cap Gemini,


how to check single or double byte in struts

1 Answers  


I need source code for Enrollment System using Visual Basic 6.0/2008 database MS Access 2007 for my school thesis project...please help me..kindly send in my email jpinedamcp@gmail.com

1 Answers  


What is the purpose of <Trigger> element of <updatePanel> in Ajax

1 Answers  


HOW TO DOWNLOAD ORCUT SITE VIDEOS IN PC WITH THE HELP OF MOZILL'S FIREFOX?

0 Answers  


Difference between abstract class and Interfaces in Java

9 Answers   Nest, Persistent, Yantro Software,


what is web service in java? have u use before.

1 Answers  


Full from of MP3?

2 Answers  


Write a Pseudo Code to find the angle between two hands of a clock for a given time.

6 Answers   Goldman Sachs, HCL,


10.Define filters,binary to hexadecimal,hexadecimal to decimal?

1 Answers  


Categories