What is the height of a complete binary tree with n nodes?
- A log2 n
- B floor(log2 n)
- C n / 2
- D 2n - 1
Explanation
A complete binary tree with n nodes is filled level by level, so its height is floor(log2 n).
What is the height of a complete binary tree with n nodes?
A complete binary tree with n nodes is filled level by level, so its height is floor(log2 n).