DotNetLightning


Heap Module

Functions and values

Function or value Description

Heap.empty isDescending

Full Usage: Heap.empty isDescending

Parameters:
    isDescending : bool

Returns: Heap<'T>

O(1). Returns a empty heap.

isDescending : bool
Returns: Heap<'T>

Heap.head xs

Full Usage: Heap.head xs

Parameters:
Returns: unit -> 'T
Modifiers: inline
Type parameters: 'T

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

xs : Heap<'T>
Returns: unit -> 'T

Heap.insert x xs

Full Usage: Heap.insert x xs

Parameters:
    x : 'T
    xs : Heap<'T>

Returns: Heap<'T>
Modifiers: inline
Type parameters: 'T

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

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

Heap.isDescending xs

Full Usage: Heap.isDescending xs

Parameters:
Returns: bool
Modifiers: inline
Type parameters: 'T

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

xs : Heap<'T>
Returns: bool

Heap.isEmpty xs

Full Usage: Heap.isEmpty xs

Parameters:
Returns: bool
Modifiers: inline
Type parameters: 'T

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

xs : Heap<'T>
Returns: bool

Heap.length xs

Full Usage: Heap.length xs

Parameters:
Returns: int
Modifiers: inline
Type parameters: 'T

O(n). Returns the count of elememts.

xs : Heap<'T>
Returns: int

Heap.merge xs ys

Full Usage: Heap.merge xs ys

Parameters:
Returns: Heap<'T>
Modifiers: inline
Type parameters: 'T

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

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

Heap.ofSeq isDescending s

Full Usage: Heap.ofSeq isDescending s

Parameters:
    isDescending : bool
    s : seq<'T>

Returns: Heap<'T>

O(n log n). Returns heap, bool isDescending, from the sequence.

isDescending : bool
s : seq<'T>
Returns: Heap<'T>

Heap.rev xs

Full Usage: Heap.rev xs

Parameters:
Returns: Heap<'T>
Modifiers: inline
Type parameters: 'T

O(n). Returns heap reversed.

xs : Heap<'T>
Returns: Heap<'T>

Heap.tail xs

Full Usage: Heap.tail xs

Parameters:
Returns: Heap<'T>
Modifiers: inline
Type parameters: 'T

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

xs : Heap<'T>
Returns: Heap<'T>

Heap.toSeq xs

Full Usage: Heap.toSeq xs

Parameters:
Returns: seq<'T>
Modifiers: inline
Type parameters: 'T

O(n). Views the given heap as a sequence.

xs : Heap<'T>
Returns: seq<'T>

Heap.tryHead xs

Full Usage: Heap.tryHead xs

Parameters:
Returns: unit -> 'T option
Modifiers: inline
Type parameters: 'T

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

xs : Heap<'T>
Returns: unit -> 'T option

Heap.tryMerge xs ys

Full Usage: Heap.tryMerge xs ys

Parameters:
Returns: Heap<'T> option
Modifiers: inline
Type parameters: 'T

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

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

Heap.tryTail xs

Full Usage: Heap.tryTail xs

Parameters:
Returns: Heap<'T> option
Modifiers: inline
Type parameters: 'T

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

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

Heap.tryUncons xs

Full Usage: Heap.tryUncons xs

Parameters:
Returns: ('T * Heap<'T>) option
Modifiers: inline
Type parameters: 'T

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

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

Heap.uncons xs

Full Usage: Heap.uncons xs

Parameters:
Returns: 'T * Heap<'T>
Modifiers: inline
Type parameters: 'T

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

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

Active patterns

Active pattern Description

Heap.(|Cons|Nil|) h

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

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