PicO said:
i need some explanation about the difference between priority queue &
set & heap ... as they all sort the data in ( n log n ) ... but the
as `priority_queue' is a container adapter, which adapt `vector' by
default (means that it uses `vector' as its default container (protected
c) underneath), and `priority_queue' also use `make_heap' and
`push_heap' as implementation to maintain the `c' as a heap.
set always use a Rb-tree to make the elements ordered.
heap, there's no container called heap, just xxxx_heap in the algorithm
only i see that priority queue only can pop the top ( maximum
element ) while set and heap can erase any element ...
no heap container again, also heap can't erase any element,
template <class RandomAccessIterator>
void pop_heap (RandomAccessIterator first, RandomAccessIterator last);
`pop_heap' just rearranges the elements in the range [first,last) in
such a way that the part considered a heap is shortened by one by
removing its highest element.