As in 5:30 sir has told we will come to reason not use priority queue but not told it in end also;
I want to know as in Priority Queue we pop in O(1) ans insert element in O(longN).
As in 5:30 sir has told we will come to reason not use priority queue but not told it in end also;
I want to know as in Priority Queue we pop in O(1) ans insert element in O(longN).
there is no solid reason to not use priority queue
you can use both priority_queue and set here
yes set has a advantage over priority_queue
that in set you can access all element but in priority queue only top element is accessible
yes
std::priority_queue
allows to do the following:
O(log n)
O(1)
O(log n)
while std::set
has more possibilities:
O(log n)
and the constant is greater than in std::priority_queue
O(log n)
O(log n)
( lower_bound
)O(log n)
iterator
O(1)
O(1)
O(1)
O(1)