how to resolve null node in binary tree?
Answers
Answered by
0
Explanation:
Every external node required two null node in Binary Tree. As per your requirement, The Binary tree has 20 nodes.
Here, we have to observe three cases :-
Case I, II :
Left sparse binary tree which is nodes will added to left side only, and other side (right side) null node will be added.
Right sparse binary tree which is nodes will added to right side only, and other side (left side) null node will be added.
These both cases n+1 external node (that means null nodes) are required where n is represented to total number of internal nodes.
As per your requirement, 21 null nodes are required for Binary tree if the tree has 20 internal nodes.
Case III :
If Binary Tree is Complete Binary tree, n+1 external nodes are required.
Similar questions