Practice mode Data Structures

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.

Report a problem

Answer checked How we write and check questions

Tip: press A, B, C or D to answer, and N for the next question.

Advertisement

Have a question about this answer?

Your email address will not be published. Required fields are marked *

Links and website addresses are not allowed in comments.