Exercise 6.1.2

Show that an nn-element heap has height lgn\lfloor \lg{n} \rfloor

This is way too obvious, that it is hard to prove it.

The number of internal nodes a complete binary tree has is 2h12^h - 1 where hh is the height of the tree. A heap of height hh has at least one additional node (otherwise it would be a heap of length h1h-1) and at most 2h2^h additional nodes (otherwise it would be a heap of length h+1h+1), which is similar to the answer in exercise 6.1-1.

Thus, if n(2h,2h+11)n \in (2^h, 2^{h+1} - 1), then the height will be lgn\lfloor \lg{n} \rfloor.