Ordered sequence

If we plan an ordered sequence for a priority queue, it can have either an ascending or a descending order. The positive side of having an order sequence is that we can quickly find the maximum or remove the maximum priority item, as we can find it using O(1) complexity. But the insertion will take more time, as we have to check each element in the queue to place the item in the right position based on its priority.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset