What is the depth of the shortest binary tree that contain 1
What is the depth of the shortest binary tree that contain 11 nodes?
Solution
the shortest binary tree that can be formed by 11 nodes only when each level is full because if the level is not full then the extra node will create an extra level.
for example consider 3 nodes.
now if all the level are not full then the depth of the tree will be 2
1,2,3 are the nodes
1
\\
2
\\
3
but if the second level is full then the depth of tree will come 1.
1
/ \\
2 3
Now, if 11 nodes are there then the depth of the shortest tree is :
first level 1 node
second level 2 nodes
third level 4 nodes
four level 4 nodes.
hence the depth is 3.
