1. The first element is always (one of) the largest.
2. You can add or remove an element in logarithmic time.
A heap is the ideal way to implement a priority queue: a queue that sorts its elements automatically
so that the “next” element always is (one of) the largest. Therefore, the heap algorithms are used by
the priority_queue container (see Section 12.3, page 641). The STL provides four algorithms to
handle a heap:
1. make_heap() converts a range of elements into a heap.
2. push_heap() adds one element to the heap.
3. pop_heap() removes the next element from the heap.
4. sort_heap() converts the heap into a sorted collection, after which it is no longer a heap.
In addition, since C++11, is_heap() and is_heap_until() are provided to check whether a
collection is a heap or to return the first element that breaks the property of a collection to be a heap
(see Section 11.5.5, page 554).
As usual, you can pass a binary predicate as the sorting criterion. The default sorting criterion is
operator