The number of leaf nodes in a rooted tree of n nodes, with each node having 0…

2002

The number of leaf nodes in a rooted tree of n nodes, with each node having 0 or 3 children is:

  1. A.

    n/2

  2. B.

    (n−1)/3

  3. C.

    (n−1)/2

  4. D.

    Let I be the number of internal nodes and L be the number of leaves. Since every internal node has exactly 3 children, the number of edges is 3I. A tree with n nodes has n - 1 edges, so 3I = n - 1 and I = (n - 1)/3. Therefore L = n - I = n - (n - 1)/3 = (2n + 1)/3.

Attempted by 47 students.

Show answer & explanation

Correct answer: D

Therefore, the number of leaf nodes is (2n + 1)/3.

A video solution is available for this question — log in and enroll to watch it.

Explore the full course: Gate Guidance By Sanchit Sir