educative.io

Educative

The total number of non-leaf nodes (n) in a complete binary tree of height “h”

This is provided by the expression:
⌊2^(h-1)⌋ ≤ n ≤ 2^h - 1

Why is the left side of this expression using the floor symbol? h - 1 will always be an integer, x and as such 2^x will always be an integer. So, I’m not sure what purpose that symbol is providing here.

Hi @Robert1,
Thanks for identifying this. Your suggestions are right and we have updated the formula.

Happy Learning!