Priority queue STL

This is a discussion on Priority queue STL within the C++ Programming forums, part of the General Programming Boards category; hi. i made use of priority queue in stl... well i know tat its not possible to iterate each and ...

  1. #1
    dpp
    dpp is offline
    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,892
    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, 10:33 AM
  3. c++ stl priority queue
    By dpp in forum C++ Programming
    Replies: 8
    Last Post: 01-01-2009, 10:43 AM
  4. Priority Queue Help
    By cjwenigma in forum C++ Programming
    Replies: 6
    Last Post: 11-14-2007, 11:48 PM
  5. STL min priority queue?
    By *ClownPimp* in forum C++ Programming
    Replies: 7
    Last Post: 04-30-2006, 11:31 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21