A Minimum Ordered Heap, also known as a MinHeap, is a data structure that is used when you are trying to access minimum values of arbitrarily sized list. It is a specific form of a Binary Heap, which is itself a more specific version of a Binary Tree.
As described on its , a tree must conform to the following two properties to be considered a Binary Heap.
Shape property: a binary heap is a ; that is, all levels of the tree, except possibly the last one (deepest) are fully filled, and, if the last level of the tree is not complete, the nodes of that level are filled from left to right.
Heap property: the key stored in each node is either greater than or equal to (≥) or less than or equal to (≤) the keys in the node's children, according to some .
Insertion of an item takes an average of O(lg N) time. Removal of items, similarly, takes O(lg N) time.
The process of converting an unsorted tree into a MinHeap is commonly called Heapify.
Plain Old Data
The plain old data for a MinHeap is just a vector of entries, each containing a key and value.