## Data Structure: Heap

Heap is a tree-based data structure. The specialty of the heap is in the ordering of the nodes. There can be 2 types of heap-

Priority queues are very frequently used data structures. Used to generate a queue so that we can process the items based on the priority of it. In this article, we are discussing the implementation of Priority Queue in JavaScript and TypeScript.

A binary Heap is a special kind of tree. For a Binary Tree to be a Binary Heap the rule is simple- Max Binary Heap- the parent node is always larger than the child nodes. Min Binary Heap- The parent node is always smaller than the children.