FSharpx.Collections


PairingHeap Module

Functions and values

Function or value Description

PairingHeap.empty maximalist

Full Usage: PairingHeap.empty maximalist

Parameters:
    maximalist : bool

Returns: PairingHeap<'a>

O(1) Returns a empty heap.

maximalist : bool
Returns: PairingHeap<'a>

PairingHeap.head xs

Full Usage: PairingHeap.head xs

Parameters:
Returns: 'T

O(1) worst case. Returns the min or max element.

xs : PairingHeap<'T>
Returns: 'T

PairingHeap.insert x xs

Full Usage: PairingHeap.insert x xs

Parameters:
Returns: PairingHeap<'T>

O(1) amortized time. Returns a new heap with the element inserted.

x : 'T
xs : PairingHeap<'T>
Returns: PairingHeap<'T>

PairingHeap.isDescending xs

Full Usage: PairingHeap.isDescending xs

Parameters:
Returns: bool

O(1). Returns true if the heap has max element at head.

xs : PairingHeap<'T>
Returns: bool

PairingHeap.isEmpty xs

Full Usage: PairingHeap.isEmpty xs

Parameters:
Returns: bool

O(1) Returns true if the heap has no elements.

xs : PairingHeap<'T>
Returns: bool

PairingHeap.length xs

Full Usage: PairingHeap.length xs

Parameters:
Returns: int

O(n). Returns the count of elements.

xs : PairingHeap<'T>
Returns: int

PairingHeap.merge xs ys

Full Usage: PairingHeap.merge xs ys

Parameters:
Returns: PairingHeap<'T>

O(1) amortized time. Returns heap from merging two heaps, both must have same descending.

xs : PairingHeap<'T>
ys : PairingHeap<'T>
Returns: PairingHeap<'T>

PairingHeap.ofSeq maximalist s

Full Usage: PairingHeap.ofSeq maximalist s

Parameters:
    maximalist : bool
    s : seq<'a>

Returns: PairingHeap<'a>

O(n). Returns heap from the sequence.

maximalist : bool
s : seq<'a>
Returns: PairingHeap<'a>

PairingHeap.tail xs

Full Usage: PairingHeap.tail xs

Parameters:
Returns: PairingHeap<'T>

O(log n) amortized time. Returns a new heap of the elements trailing the head.

xs : PairingHeap<'T>
Returns: PairingHeap<'T>

PairingHeap.tryGetHead xs

Full Usage: PairingHeap.tryGetHead xs

Parameters:
Returns: 'T option

O(1) worst case. Returns option first min or max element.

xs : PairingHeap<'T>
Returns: 'T option

PairingHeap.tryGetTail xs

Full Usage: PairingHeap.tryGetTail xs

Parameters:
Returns: PairingHeap<'T> option

O(log n) amortized time. Returns option heap of the elements trailing the head.

xs : PairingHeap<'T>
Returns: PairingHeap<'T> option

PairingHeap.tryMerge xs ys

Full Usage: PairingHeap.tryMerge xs ys

Parameters:
Returns: PairingHeap<'T> option

O(1) amortized time. Returns heap option from merging two heaps.

xs : PairingHeap<'T>
ys : PairingHeap<'T>
Returns: PairingHeap<'T> option

PairingHeap.tryUncons xs

Full Usage: PairingHeap.tryUncons xs

Parameters:
Returns: ('T * PairingHeap<'T>) option

O(log n) amortized time. Returns option head element and tail.

xs : PairingHeap<'T>
Returns: ('T * PairingHeap<'T>) option

PairingHeap.uncons xs

Full Usage: PairingHeap.uncons xs

Parameters:
Returns: 'T * PairingHeap<'T>

O(log n) amortized time. Returns the head element and tail.

xs : PairingHeap<'T>
Returns: 'T * PairingHeap<'T>

Active patterns

Active pattern Description

PairingHeap.(|Cons|Nil|) h

Full Usage: PairingHeap.(|Cons|Nil|) h

Parameters:
Returns: Choice<('T * PairingHeap<'T>), unit>
h : PairingHeap<'T>
Returns: Choice<('T * PairingHeap<'T>), unit>