Thread: Priority queue STL

  1. #1
    Registered User
    Join Date
    Jan 2009
    Posts
    197

    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

  2. #2
    Registered User C_ntua's Avatar
    Join Date
    Jun 2008
    Posts
    1,853
    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.

  3. #3
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,895
    There are dynamically updateable priority queues out there. A web search might reveal them.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Help with FIFO QUEUE
    By jackfraust in forum C++ Programming
    Replies: 23
    Last Post: 04-03-2009, 08:17 AM
  2. Minimum priority queue STL
    By dpp in forum C++ Programming
    Replies: 7
    Last Post: 01-02-2009, 11:33 AM
  3. c++ stl priority queue
    By dpp in forum C++ Programming
    Replies: 8
    Last Post: 01-01-2009, 11:43 AM
  4. Priority Queue Help
    By cjwenigma in forum C++ Programming
    Replies: 6
    Last Post: 11-15-2007, 12:48 AM
  5. STL min priority queue?
    By *ClownPimp* in forum C++ Programming
    Replies: 7
    Last Post: 04-30-2006, 11:31 AM