GATE / CS ARCHIVE

GATE CSE 1998 / QUESTION 2.11

Leaves in a full n-ary tree

Discrete Mathematics · Trees & Connectivity · Full GATE CSE 1998 paper

GATE 1998, Q2.11 2 marks · MCQ
Report issue

Trees & Connectivity

Question 2.11, GATE 1998: Every node has either 0 or n children. If x nodes are internal, how many leaves are there?
Tap to enlarge
Your answer
Answer & solution

Answer: A: x (n−1)+1 (no official key was published)

Each internal node contributes exactly n child edges, so the tree has nx edges. If it has L leaves, its total vertices are x+L, and any tree has one fewer edge than vertices: nx=x+L−1. Rearranging yields L=x (n−1)+1, A. The explicit 0-or-n condition is essential; it prevents one-child or partially populated internal nodes from invalidating the count. For x=0 it correctly gives a single root leaf.

Original paper, page 4