Struct addressable_pairing_heap::PairingHeap [] [src]

pub struct PairingHeap<T, K> where
    K: Key
{ /* fields omitted */ }

An addressable pairing heap implementation.

Stores elements with an associated key. The key can be thought of as the priority of the element that is associated to it.

Supports usages like take_min that takes the element with the minimum key out of this storage.

Inserting elements into this data structure provides the caller with handles that makes accessing the elements possible - this is called "addressable". Handles are always local to the associated pairing heap instance and thus should not be exchanged throughout various instances of pairing heaps.

An special feature of addressable pairing heaps is the possibility to explicitely decrease the key of an already stored element with the decrease_key operation which simply increases the priority of the associated element.

It is possible to use different implementations for Key as the key type.

Methods

impl<T, K> PairingHeap<T, K> where
    K: Key
[src]

Creates a new instance of a PairingHeap.

Returns the number of elements stored in this PairingHeap.

Returns true if this PairingHeap is empty.

Inserts the given element into the PairingHeap with its associated key and returns a Handle to it that allows to directly address it.

The handle is for example required in order to use methods like decrease_key.

Decreases the key of the element with the associated given handle. Will panic if the given new key is not lower than the previous key.

Returns a reference to the element associated with the given handle.

Returns a mutable reference to the element associated with the given handle.

Returns a reference to the element associated with the given handle.

Does not perform bounds checking so use it carefully!

Returns a mutable reference to the element associated with the given handle.

Does not perform bounds checking so use it carefully!

Returns a reference to the current minimum element if not empty.

Returns a reference to the current minimum element.

Does not perform bounds checking so use it carefully!

Returns a mutable reference to the current minimum element if not empty.

Returns a reference to the current minimum element without bounds checking. So use it very carefully!

Removes the element associated with the minimum key within this PairingHeap and returns it.

Removes the element associated with the minimum key within this PairingHeap without checking for emptiness and returns it.

So use this method carefully!

Iterate over the values in this PairingHeap by reference in unspecified order.

Iterate over the values in this PairingHeap by mutable reference unspecified order.

Iterate over values stored within a PairingHeap in a sorted-by-min order. Drains the heap.

Trait Implementations

impl<T: Debug, K: Debug> Debug for PairingHeap<T, K> where
    K: Key
[src]

Formats the value using the given formatter.

impl<T: Clone, K: Clone> Clone for PairingHeap<T, K> where
    K: Key
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl<T, K> Index<Handle> for PairingHeap<T, K> where
    K: Key
[src]

The returned type after indexing

The method for the indexing (container[index]) operation

impl<T, K> IndexMut<Handle> for PairingHeap<T, K> where
    K: Key
[src]

The method for the mutable indexing (container[index]) operation