What is the maximum number of nodes in a binary tree of height 3, where height is the number of edges on the longest root-to-leaf path?
Correct answer D. 15
Explanation
With height h measured in edges, the tree has levels 0 to h, holding at most 1 + 2 + 4 + ... + 2^h = 2^(h+1) − 1 nodes. For h = 3 that is 2^4 − 1 = 15, reached by a perfect binary tree. The answer 7 comes from using 2^h − 1, which applies only when height is counted in levels rather than edges.
Answer checked How we write and check questions
Discussion