The depth of a complete binary tree is given by:
2025
The depth of a complete binary tree is given by:
Answer: B. floor ( log2(n) ) — For a complete binary tree with n nodes, the depth is determined by how many levels are needed to store all nodes. Since binary trees double in capacity per…
- A.
log2(n)
- B.
floor ( log2(n) )
- C.
n . log2(n) + 1
- D.
n . log2(n)
Attempted by 411 students.
Show answer & explanation
Correct answer: B
For a complete binary tree with n nodes, the depth is determined by how many levels are needed to store all nodes. Since binary trees double in capacity per level, the depth is mathematically defined as floor(log2(n)).
Loading lesson…