Given binary tree with N nodes and height h.Prove $\lfloor{\log_2(N)}\rfloor\leq h$.

226 Views Asked by At

Given binary tree with N nodes and height h.Prove $\lfloor{\log_2(N)}\rfloor\leq h$. I Know that in non empty binary tree: $N \leq 2^{h+1}-1 $ After simple manipulations I get that: $\log_2(N+1)-1\leq h$ But I cant think of way to prove that $\lfloor{\log_2(N)}\rfloor\leq h$

1

There are 1 best solutions below

3
On

\begin{align} N&\le 2^{h+1}-1\\ N&<2^{h+1}\\ \log_2 N&<h+1\\ \lfloor \log_2 N\rfloor&<h+1\\ \lfloor \log_2 N\rfloor&\le h \end{align}