A binary tree with 27 nodes has _______ null branches.

2010

A binary tree with 27 nodes has _______ null branches.

Answer: D. None of these valuesConceptIn a binary tree every node carries exactly two branch fields, a left one and a right one. A branch field that does not lead to a child node is a null…

  1. A.

    54

  2. B.

    27

  3. C.

    26

  4. D.

    None of these values

Attempted by 137 students.

Show answer & explanation

Correct answer: D

Concept

In a binary tree every node carries exactly two branch fields, a left one and a right one. A branch field that does not lead to a child node is a null branch.

For any binary tree with n nodes there are 2n branch fields in all, and exactly n − 1 of them lead to a child, because every node except the root is reached from exactly one parent. Subtracting gives null branches = 2n − (n − 1) = n + 1, a value that depends only on n and not on the shape of the tree.

Application

  1. Here the tree has n = 27 nodes, so the number of branch fields is 2 × 27 = 54.

  2. Joining 27 nodes into one tree uses 27 − 1 = 26 parent-to-child edges, so 26 branch fields lead to a child.

  3. The remaining branch fields are null: 54 − 26 = 28.

  4. The same result follows directly from the formula: n + 1 = 27 + 1 = 28.

Cross-check

Test the rule on small trees. A tree of one node (n = 1) has two empty branch fields, and n + 1 = 2. A three-node tree, a root with two children, has four empty branch fields, and n + 1 = 4. The count matches in every arrangement, so 28 is correct for n = 27.

Comparing 28 with the values offered:

Value

What it counts in a 27-node tree

54

All branch positions, 2n

26

Only the branch positions that lead to a child, n − 1

27

The node count itself, n

None of these equals 28, so the correct choice is the one stating that none of the listed values applies.

Explore the full course: Coding For Placement

Loading lesson…