O(1) replacement for std::priority_queue

M

Michael DOUBEZ

Can the O(1) Ladder Priority queue (http://dl.acm.org/citation.cfm?id=1103324) be applied generally; e.g. wherever a std::priority_queue is used?

Please quote the whole specs, it is not O(1) complexity but "O(1)
average time complexity" ("[...]theoretically justified to be true in
this article on the assumption that the mean of μ is finite and
greater than zero, regardless of its variance.[...]")

Please note that std::priority_queue is intended as a container
adaptor: it inserts the elements in a ordered fashion.

The only point that could be made is that the standard library could
provide a tree-based priority queue (with a min-heap by example).

Michael
 
J

Juha Nieminen

Michael DOUBEZ said:
The only point that could be made is that the standard library could
provide a tree-based priority queue (with a min-heap by example).

I thought std::priority_queue already uses a "tree-based" algorithm.
In other words, it organizes the elements as a heap in the vector
(or whatever container is specified).
 
M

Michael DOUBEZ

  I thought std::priority_queue already uses a "tree-based" algorithm.
In other words, it organizes the elements as a heap in the vector
(or whatever container is specified).

So it does. My mistake.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,021
Latest member
AkilahJaim

Latest Threads

Top