Table of Contents

About

A heap is a tree data structure constructed from the priority number that needs to satisfy a heap property

The number is called priority because priority queues are often implemented this way

Usage

Heaps are favourite data structures for many applications:

Property

A heap can satisfy one of this two property:

Min Heap

In a min heap:

  • the root store the lowest priority element
  • the priority value of a parent node is less than or equal to the priority value of child

Max heap

In a max heap,

  • the root store the highest priority element
  • the priority value of a parent is greater than or equal to the priority value of child

Example: a binary max heap (By Ermishin - Own work, CC BY-SA 3.0)

Binary Max Heap

Characteristic

Documentation / Reference