In: Computer Science
Is there an implicit prioritization in an traditional queue? If so, what is it?
`Hey,
Note: Brother in case of any queries, just comment in box I would be very happy to assist all your queries
A priority queue is a data structure that is meant to hold objects that require ``service'' (e.g., use of a printer). The essential operations are:
Here is an example, where string objects are inserted with priority numbers:
insert(8, "abc") insert(3, "def") insert(4, "ghi") retrieve() ("def" is returned) insert(2, "jkl") retrieve() ("jkl" is returned) insert(4, "mno") retrieve() ("ghi" is returned) retrieve() ("mno" is returned)
At this point, the priority queue still holds "abc", whose low priority has prevented it from leaving.
As usual, we require an implementation of a priority queue where insertion and retrieval take time that is less than linear, in terms of the number of objects held in the queue. Since there is an implicit ordering involved with insertion, So, we can say that it has implicit prioritization
Kindly revert for any queries
Thanks.