fsprojects/FSharpx.Collections


PairingHeap

Namespace: FSharpx.Collections.Experimental

Functions and values

Function or valueDescription
empty maximalist
Signature: maximalist:bool -> PairingHeap<'a>
Type parameters: 'a

O(1) Returns a empty heap.

head xs
Signature: xs:PairingHeap<'T> -> 'T
Type parameters: 'T

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

insert x xs
Signature: x:'T -> xs:PairingHeap<'T> -> PairingHeap<'T>
Type parameters: 'T

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

isDescending xs
Signature: xs:PairingHeap<'T> -> bool
Type parameters: 'T

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

isEmpty xs
Signature: xs:PairingHeap<'T> -> bool
Type parameters: 'T

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

length xs
Signature: xs:PairingHeap<'T> -> int
Type parameters: 'T

O(n). Returns the count of elememts.

merge xs ys
Signature: xs:PairingHeap<'T> -> ys:PairingHeap<'T> -> PairingHeap<'T>
Type parameters: 'T

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

ofSeq maximalist s
Signature: maximalist:bool -> s:seq<'?12854> -> PairingHeap<'?12854>
Type parameters: '?12854

O(n). Returns heap from the sequence.

tail xs
Signature: xs:PairingHeap<'T> -> PairingHeap<'T>
Type parameters: 'T

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

tryGetHead xs
Signature: xs:PairingHeap<'T> -> 'T option
Type parameters: 'T

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

tryGetTail xs
Signature: xs:PairingHeap<'T> -> PairingHeap<'T> option
Type parameters: 'T

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

tryMerge xs ys
Signature: xs:PairingHeap<'T> -> ys:PairingHeap<'T> -> PairingHeap<'T> option
Type parameters: 'T

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

tryUncons xs
Signature: xs:PairingHeap<'T> -> ('T * PairingHeap<'T>) option
Type parameters: 'T

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

uncons xs
Signature: xs:PairingHeap<'T> -> 'T * PairingHeap<'T>
Type parameters: 'T

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

Active patterns

Active patternDescription
( |Cons|Nil| ) h
Signature: h:PairingHeap<'T> -> Choice<('T * PairingHeap<'T>),unit>
Type parameters: 'T

CompiledName: |Cons|Nil|

Fork me on GitHub