MCN Professionals | Interview Question of the day
MCN Professionals is starting Industrial Training for MCA-2012 Batch. Have a look at our Industrial Training Program and Course Details.
-----------------------------------------------------------------------------------------------------------------------------------------
Today's Question:
Given a Binary Tree with n Nodes (you may arrange these nodes any way you want to). How many NULL pointers will be there ?
You want options also :).. here are the options
A) n B)
n+1 C) n-1 D)
None
Solution:
The Answer is n+1.
No matter how you arrange n nodes in a binary tree, there will always be n+1 NULL pointers. for example, if n=3, then below are the possible arrangements of a Binary tree with 3 nodes, all the arrangements have 4 NULL pointers (marked 1,2,3,4)

You may try with any number of nodes in the tree, there will always be n+1 NULL pointers in a Binary tree with n Nodes.
---------------------------------------------------------------------------
Interview Questions Archive:
To see all the questions in the category click
here...