A complete n-ary tree is a tree in which each node has n children or no…
20072020
A complete n-ary tree is a tree in which each node has n children or no children. Let I be the number of internal nodes and L be the number of leaves in a complete n-ary tree. If L = 41, and I = 10, what is the value of n?
- A.
3
- B.
4
- C.
5
- D.
6
Attempted by 184 students.
Show answer & explanation
Correct answer: C
Key fact: in a complete n-ary tree each internal node has n children, so total edges = I × n. Total edges also equal total nodes minus 1 = (I + L) − 1.
Write the equality for edges: I × n = I + L − 1.
Rearrange to solve for n: I × (n − 1) = L − 1, so n = 1 + (L − 1)/I.
Substitute the given values L = 41 and I = 10: n = 1 + (41 − 1)/10 = 1 + 40/10 = 1 + 4 = 5.
Therefore, n = 5.
A video solution is available for this question — log in and enroll to watch it.