title: Height of heap with n elements
body: <p>I am having the following question:</p>
  
  <p>"The height of a tree is the length of the longest branch of the tree. From the definition of height, what is the height of a heap with n elements? Give a clear and precise explanation with your answer."</p>
  
  <p>Heap = binary tree</p>
  
  <p>I know that the number of a complete binary tree is 2^(n° of levels - 1)</p>
  
  <p>So far I tried the following:</p>
  
  <p>If there are three heaps (2 complete binary trees and 1 non complete binary tree) such that:</p>
  
  <ul>
  <li>Heap A = is a complete binary tree, of height H</li>
  <li>Heap B = is a binary tree of height with more nodes than A but less than C (so has same height as C - I think?)</li>
  <li>Heap C = is a binary tree of height H + 1</li>
  </ul>
  
  <p>I can say that the height of B is between the height of A and C and the number of elements of B is between 2^(n° levels of A - 1) and 2^(n° levels of C - 1).</p>
  
  <p>But I am not sure how to what is the height of a heap with n elements.</p>