Re: C++ priority queue with bubble-up and bubble-down?

Discussion in 'C++' started by mlimber, Aug 5, 2008.

  1. mlimber

    mlimber Guest

    On Aug 5, 2:25 pm, Stuart Golodetz
    <> wrote:
    > Stuart Golodetz wrote:
    > > Just wondering what you'd recommend in terms of a C++ priority queue
    > > implementation that supports bubble-up and bubble-down operations
    > > please? std::priority_queue doesn't seem to support doing that, and I
    > > couldn't find an alternative in Boost. I could write my own, but that
    > > feels a little bit like reinventing the wheel, so I thought it was worth
    > > asking first.

    >
    > When I said "bubble-up" and "bubble-down", what I really meant was
    > increase key and decrease key (not necessarily respectively). Just to
    > clarify :)


    Technically a PQ doesn't support bubble/key operations. You're wanting
    a heap. Check out std::make_heap, std::sort_heap, and related
    functions.

    Cheers! --M
     
    mlimber, Aug 5, 2008
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Russell Warren

    Is Queue.Queue.queue.clear() thread-safe?

    Russell Warren, Jun 22, 2006, in forum: Python
    Replies:
    4
    Views:
    688
    Russell Warren
    Jun 27, 2006
  2. Replies:
    4
    Views:
    2,831
    red floyd
    Sep 21, 2006
  3. Marcel Müller
    Replies:
    3
    Views:
    567
    Marcel Müller
    Apr 27, 2009
  4. Kris
    Replies:
    0
    Views:
    489
  5. Mason Kelsey
    Replies:
    5
    Views:
    111
    Mason Kelsey
    Sep 27, 2009
Loading...

Share This Page