Multiple choice

In a binary tree with n nodes, every node has an odd number of descendants. Every node is considered to be its own descendant. What is the number of nodes in the tree that have exactly one child?

  1. 0

  2. 1

  3. (n − 1) / 2

  4. n -1

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

If a node has exactly one child, then total descendants = 1 (child) + 1 (itself, as stated) = 2, which is even. This contradicts the condition that every node has an odd number of descendants. Therefore, no node can have exactly one child. The only possibilities that satisfy the odd-descendant condition are: leaf nodes (1 descendant - itself) or nodes with exactly two children (3 descendants - itself + 2 children).