edited by
2,195 views

1 Answer

2 2 votes

Priority queue has the priority associated with each element.

so 1 queue will store the elements and 2nd queue will give the priority to the elements which are stored in the queue.

we will need 2 queues

Position:
Show:

Related questions

0 0 votes
0 0 answers
982
982 views
srestha asked Dec 22, 2018
982 views
Is priority queue work efficiently with sorted array than unsorted array and heap for insertion and deletion operation? Then why do we apply priority queue in heap specia...
0 0 votes
1 1 answer
1.7k
1.7k views
pallaviamu asked Jun 17, 2018
1,690 views
On other sources, it is given that we need to assign high priorities to newly inserted element in case of stack otherwise low priority to newly inserted element in case o...
0 0 votes
1 1 answer
1.3k
1.3k views
rahul sharma 5 asked Dec 17, 2016
1,271 views
How to implement Priority queue using stack?What will be time complexity for Enqueue and Dequeue operations?Edit:- Updated the question clearly
4 4 votes
1 1 answer
164
164 views
GO Classes asked Jul 22
164 views
Consider the following min-heap where each node is written as $\texttt{(value, priority)}$:Now perform these operations in order:$\texttt{updatePriority(A, 8)}$ $\texttt{...