Question:

The height of a binary tree is the number of edges in the longest path from the root to a leaf in the tree. The maximum possible height of a full binary tree with 23 nodes is __________. (answer in integer)

Show Hint

A full binary tree needs an odd number of nodes, with \(N = 2I+1\) for \(I\) internal nodes. To maximize height for a fixed \(N\), build a caterpillar shaped tree, whose minimum node count for height \(h\) is \(2h+1\); solve \(2h+1 \le N\) for the largest integer \(h\).
Updated On: Jul 22, 2026
Show Solution
collegedunia
Verified By Collegedunia

Correct Answer: 11

Solution and Explanation

Step 1: Recall the definition of a full binary tree.

A full binary tree (also called a strict binary tree) is one in which every node has either exactly 0 children (a leaf) or exactly 2 children (an internal node). No node is allowed to have exactly 1 child.

Step 2: Use the leaf-internal node relationship.

For any full binary tree, if \(I\) is the number of internal nodes (each contributing exactly 2 children) and \(L\) is the number of leaves, then \(L = I + 1\). The total number of nodes is \(N = I + L = 2I + 1\), which is always odd. Here \(N = 23\) is odd, consistent with this, giving \(I = 11\) and \(L = 12\).

Step 3: Identify the shape that maximizes height for a fixed number of nodes.

To get the tallest possible full binary tree from a fixed node budget, the tree should use as few nodes as possible at each level while still respecting the full binary tree rule. This is achieved by a caterpillar shaped tree: at every level except the deepest, one internal node has exactly one child that is a leaf (using up a node without extending the depth) and one child that continues the path downward to the next level, until finally the path ends in a single leaf at the bottom.

Step 4: Find the minimum number of nodes needed to reach a given height \(h\) with this caterpillar shape.

Each of the \(h\) internal spine nodes contributes exactly one extra leaf sibling, and the spine itself has \(h+1\) nodes from the root down to the final leaf at depth \(h\). Counting carefully, the minimum node count for a full binary tree of height \(h\) is \(2h + 1\) (this matches small cases: height 1 needs 3 nodes, that is, a root with two leaf children; height 2 needs 5 nodes).

Step 5: Find the maximum height achievable with 23 nodes.

We need the largest \(h\) such that \(2h + 1 \le 23\), which gives \(h \le 11\). At \(h = 11\), the minimum node requirement is exactly \(2(11) + 1 = 23\), matching the available node count exactly, so a full binary tree of height 11 using precisely 23 nodes exists (the caterpillar shape itself, with no nodes left over that would need to be placed elsewhere).

Step 6: Rule out height 12.

Height 12 would require at least \(2(12) + 1 = 25\) nodes, which exceeds the available 23 nodes, so height 12 is not achievable.

Step 7: Conclusion.

The maximum possible height of a full binary tree with 23 nodes is 11.
\[ \boxed{11} \]
Was this answer helpful?
0
0