In ternary tre the no. Of internal nodes of degree 1,2 and 3 is 4 ,3 and 3 respectively the no. Of leaf nodes in the ternary tree is
Answers
Answer:
Total number of leaf nodes is 10.
Step-by-step explanation:
It is given that:
The nodes with degree 1 is 4. (therefore, degree = internal nodes + the root = 1+1=2)
The nodes with degree 2 is 3. (therefore, degree = internal nodes + the root = 2+1=3)
The nodes with degree 3 is 3. (therefore, degree = internal nodes + the root = 3+1=4)
There is also the first node (root) which has a degree of 0+3 = 3
Let the number of leaf nodes be N. The degree of those leaf nodes is 1 because they are only attached to their parent.
Total number of nodes in tree = internal nodes + leafs node = 4 + 3 + 3 + N = 10 + N.
Therefore, the total number of edges = total number of nodes - 1 = 9+N.
For ternary trees: Sum of degrees of all vertices = 2*total number of edges.
(1*3) + (2*4) + (3*3) + (4*2) + (N*1) = 2(9+N)
3 + 8 + 9 + 8 + N = 18 + 2N
N = 10.