Is it possible to include both (1) insertion and removal for the priority queue?
By using the priority queue pile and the time of running the Fibonacci pile, it seems that removing O. (LogN) copy is not possible to get better time. > I am trying to implement a data structure where n items are given, I have to be half in the maximum priority queue and half in the minimum priority queue. Then I want to remove all the n objects gradually.
I can include all N elements in O (n) time, but all the N objects will be removed and taken (n * logen), so I am thinking that another approach is more suitable Ho. If you remove the priority queue o (1) entry and O (1), you (n) that
In time, a list of n objects can be used to sort as explained, you can not sort into O (n) in the normal case, so the (1) entry without further assumptions on input and It would be impossible to construct a primary line with O (1) exit. / P>
For example, the priority queue in which o (1) insertion and o (k) (the maximum element which can be inserted) can be removed. Keep a table of Kashmir linked list. The inclusion of In practice, using a table of calculations will work better. Increasing a variable-length integer is not persistent until you use refined analysis (that is why I used it in the previous paragraph Not used in), but in practice you will not need the same length anyway. In addition, in practice this will be bad for the big Kashmir, even though k is stable - you can quickly get out of memory and scanning for non-zero elements can take some time. x puts one code in front of the
x th list. Before deleting, you must scan through the table to find the non-empty list (then delete the first item in the list and return the indicator to that list). Only Kashmir lists, hence withdrawal (o) takes time if Kashmir is continuous, which works for O (1) eviction.
No comments:
Post a Comment