A heap is a binary tree storing keys at its nodes and satisfying the following properties:

  • Order (heap)

    Heap-Order: for every internal node other than the root, .

    Link to original
  • Complete Binary Tree: let be the height of the heap For , there are nodes of depth . At depth , the internal nodes are to the left of the external nodes.
  • The last node of a heap is the rightmost node of maximum depth.

Height (heap)

Height of a Heap A heap storing keys has height . Proof by applying the complete binary tree property:

  • Let be the height of a heap storing keys.
  • Since there are keys at depth and at least one key at depth , we have .
  • Hence, or otherwise .
Link to original