FSharpx.Collections


PriorityQueue

Namespace: FSharpx.Collections
Attributes:
[<RequireQualifiedAccess>]

Functions and values

Function or valueDescription
PriorityQueue.empty(isDescending)
Signature: isDescending:bool -> IPriorityQueue<'T>
Type parameters: 'T

O(1). Returns a empty queue, with indicated ordering.

PriorityQueue.insert element pq
Signature: element:'T -> pq:IPriorityQueue<'T> -> IPriorityQueue<'T>
Type parameters: 'T

O(log n) amortized time. Returns a new queue with the element added to the end.

PriorityQueue.isEmpty(pq)
Signature: pq:IPriorityQueue<'T> -> bool
Type parameters: 'T

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

PriorityQueue.peek(pq)
Signature: pq:IPriorityQueue<'T> -> 'T
Type parameters: 'T

O(1). Returns the first element.

PriorityQueue.pop(pq)
Signature: pq:IPriorityQueue<'T> -> 'T * IPriorityQueue<'T>
Type parameters: 'T

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

PriorityQueue.tryPeek(pq)
Signature: pq:IPriorityQueue<'T> -> 'T option
Type parameters: 'T

O(1). Returns option first element.

PriorityQueue.tryPop(pq)
Signature: pq:IPriorityQueue<'T> -> ('T * IPriorityQueue<'T>) option
Type parameters: 'T

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

Fork me on GitHub