priority queues (heaps figure leftinitial heaprightafter percolatedown( figure leftafter percolatedown( )rightafter percolatedown( figure leftafter percolatedown( )rightafter percolatedown( theorem for the perfect binary tree of height containing + - nodesthe sum of the heights of the nodes is + ( proof it is easy to see that this tree consists of node at height nodes at height nodes at height and in general nodes at height the sum of the heights of all the nodes is then