**Definition 1**

A heap is a data structure that is a special case of a binary tree. In which the value of each node is greater than the values of its leaves. Thus a parent is always greater in value than itâ€™s children. A heap is a used in implementation of a priority queue, as well as a heap sort algorithm.

**Definition 2**

A heap is also a special area of memory. Its complement is the stack. It is used to store data that is initialized, created while a program is executing.