I have a problem with stl priority queue.I want to have the priority queue in the increasing
order,which is decreasing by default.Is there any way to do this in priority queue.
And what is the complexity of building stl priority queue.If i use quick sort in an array which takes O(nlgn) is its complexity is similar to using priority queue???
Plz someone ans.Advanced thanx.
Use a different comparator as the 3rd template argument of
std::priority_queue.priority_queue is a container adaptor that works on any sequence you define. The performance of insertion is equal to the
std::push_heapoperation and takes logarithmic time. So the complexity to sorting after all insertions are done isn’t equal. If you insert a fixed amount and work the queue afterwards avectorand a singlesortcould be more efficient.