1、
make_heap
The first version of the
make_heap algorithm arranges the elements in the range
[first, last) into a heap using less than (
operator<) to perform comparisons. The second version uses the comparison operator
comp to perform the comparisons. Since the only requirements for a heap are the two listed above,
make_heap is not required to do anything within the range
(first, last - 1).
2、
push_heap
Note that the
push_heap algorithm does
not place an element into the heap's underlying container. You must user another function to add the element to the end of the container before applying
push_heap using the
push_back member function..
3、
pop_heap
It then swaps the value in the location
first with the value in the location
last - 1 and makes
[first, last -1)back into a heap. You can then access the element in
last using the vector or deque
back() member function, or remove the element using the
pop_back member function. Note that
pop_heap does
not actually remove the element from the data structure, you must use another function to do that.
参考文献: