-
Priority queue STL
hi. i made use of priority queue in stl...
well i know tat its not possible to iterate each and every elemnt in the q.
wat i need is to update certain queue value as a part of my algorithm....
i need not push the updated value as a new elemnt in the queue..
i want it to be updated...
any suggestions please
thanks
-
Don't use the priority_queue. Use a vector/queue/dequeue and sort everytime you enter something. Wrap it around a nice class to do this automatically.
Or use priority_queue and top() and pop() until you find what you want. Update and put the values back in. Not the best idea though.
-
There are dynamically updateable priority queues out there. A web search might reveal them.