Skip to content

Restoration

  • On every insertion/removal, the heap has to be restored in order to "restore" its data structure properties (max/min order)

  • Restoration on insertion

  • Bubble the item upwards, by comparing it with the parent nodes

  • Restoration on removal

  • The last item in the complete tree goes to the top
  • Bubble the item downwards, by comparing it with the child nodes