Answer the question
In order to leave comments, you need to log in
Which priority queue is faster?
Which priority queue is faster?
I choose from:
Answer the question
In order to leave comments, you need to log in
So everything is simple, take practical implementations, write tests that reflect your "planned nature of the load" and take measurements.
God, how difficult it is. You take and make as many queues as you need priorities. And that's it.
I would do on std::deque. Inserting at the beginning and pulling out from the end works for him in a swoop. Sorting and accessing is slightly slower than std::vector, but faster than all the others. You will have to sort after each addition of a node (if you do it lazily, you can sort before access, but it depends on the load, checking before access can eat up all the benefits of laziness). If the additions are not frequent, then you can do it on the vector, the volume is negligible.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question