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
Physics,
7 months ago
Math,
7 months ago
English,
7 months ago
Social Sciences,
1 year ago
Computer Science,
1 year ago
Math,
1 year ago