Heap
< QueueA heap is a tree-like data structure that complies with the heap property. I'll explain that property in a bit, but first here's an example of a heap.
About trees
A tree is a collection of items on which a couple of relations are defined. Such items are called nodes. If an arrow is drawn from node A to node B, this means that node A is the parent of node B. The latter is a child of node A.
A tree starts at its root node, which is the only element that doesn't have a parent.
The heap property
A heap is a tree, but satisfies a requirement that we call the heap property. In the example above, every parent is strictly less than its children. Therefore, the root node is the smallest node in the entire tree. We call this type of heap a min-heap.
Similarly, a max-heap requires that every parent is strictly greater than its children. Therefore, the root node is the largest node in the entire tree.
< Queue
