An N-ary tree has N sub-nodes for each node, it has M non-leaf nodes
Find the no of leaf nodes?
Submitted by: Administratorconsider a N-ary tree with depth d
Total no of nodes in the tree, T=1+N+N^2+...+N^d= (1-N^(d+1))/(1-N) --(1)
No. of non leaf nodes, M=(1-N^d)/(1-N) ---(2)
No. of leaf nodes = T-M = N^d ---(3)
from eq (2), d= log(base N) [MN-M+1] ---(4)
Therefore, no of leaf nodes = N^d = MN-M+1
Submitted by: Administrator
Total no of nodes in the tree, T=1+N+N^2+...+N^d= (1-N^(d+1))/(1-N) --(1)
No. of non leaf nodes, M=(1-N^d)/(1-N) ---(2)
No. of leaf nodes = T-M = N^d ---(3)
from eq (2), d= log(base N) [MN-M+1] ---(4)
Therefore, no of leaf nodes = N^d = MN-M+1
Submitted by: Administrator
Read Online Placement Assistance Job Interview Questions And Answers
Top Placement Assistance Questions
☺ | Accenture HR Interview Questions: |
☺ | Interview procedure for Non-voice tech support: |
☺ | What are the questions for ISRO interview in Maths? |
☺ | How to prepare for ISRO Interview: |
☺ | GE Interview Procedure and Written test Pattern: |
Top Basic Job Categories
☺ | Targeted Selection Interview Questions. |
☺ | Business intelligence Interview Questions. |
☺ | Puzzles Interview Questions. |
☺ | Behavioral Interview Questions. |
☺ | Freshers Graduate Interview Questions. |