A complete binary tree with n non-leaf nodes contains
2016
A complete binary tree with n non-leaf nodes contains
- A.
log2 n nodes
- B.
n+1 nodes
- C.
2n nodes
- D.
2n+1 nodes
Attempted by 406 students.
Show answer & explanation
Correct answer: D
This question assumes the full binary tree property where every internal node has two children. In such a tree, the number of leaf nodes is always one more than the number of internal (non-leaf) nodes. For n non-leaf nodes, there are n + 1 leaf nodes, resulting in a total of 2n + 1 nodes.
A video solution is available for this question — log in and enroll to watch it.