A complete binary tree T have n leaf nodes. What is the number of nodes with…

2021

A complete binary tree T have n leaf nodes. What is the number of nodes with degree of 2 in tree T?

  1. A.

    n

  2. B.

    n/2

  3. C.

    n-1

  4. D.

    2n

Attempted by 379 students.

Show answer & explanation

Correct answer: C

In a complete binary tree, every internal node has exactly two children. The number of leaf nodes (n) is related to the number of internal nodes (nodes with degree 2).

Let the number of nodes with degree 2 be x. Each such node contributes two edges to the tree. The total number of edges in a tree with n leaves and x internal nodes is n + x - 1.

Since each internal node contributes two edges, the total number of edges is also 2x. Equating the two expressions: 2x = n + x - 1.

Solving for x: 2x - x = n - 1 → x = n - 1.

Thus, the number of nodes with degree 2 is n - 1.

Explore the full course: Up Lt Grade Assistant Teacher 2025