| |
GeekInterview.com > Placement Papers > Adobe
| Print | |
Question: An N-ary tree has N sub-nodes for each node, it has M non-leaf nodes Find the no of leaf nodes?
|
| April 04, 2007 03:34:41 |
#10 |
| abhishek |
Member Since: Visitor Total Comments: N/A |
RE: An N-ary tree has N sub-nodes for each node, it ha... |
Let total height of N-ary tree == i According to question leaf nodes exists only at last level , i.e at ith level so N^0 + N^1 + ...............+ N^(i-1) = M on solving this , we get : N^(i) = M(N-1) + 1 which is equal to total no. of leaf nodes |
| |
Back To Question | |