Skip to content

Rust is missing an advanced heap #11

Description

@Gankra

One that lets you modify the priority of keys.

My academic background tells me that a pairing_heap is excellent, but I've also heard good things of a meldable heap?

Of note is a nasty API issue around how you specify that a key is to be reprioritized.

My intuition is that push returns a token, and then you increase_key(&token, new_weight) or whatever. The token is a pointer to the node that contains the element, but this has a fundamental memory safety issue (the element associated with the token may have been popped).

One solution is to just make decrease/increase unsafe.

The other is to use Rcs internally, and have tokens be a Weak.

Neither is super great, honestly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions