Write algorithm insert and delete an item from priority queue
Answers
Answered by
1
The code for insert in the priority queue is the same as for push in the stack. To implement remove the maximum, we can add code like the inner loop of selection sort to exchange the maximum item with the item at the end and then delete that one, as we did with pop() for stacks.
Similar questions