PriorityQueue<'TKey> Type

Implements a heap based priority queue that hold only keys. The key with the minimum value can then retrieved from the queue. This class is not thread safe.

Constructors

Constructor Description

PriorityQueue()

Full Usage: PriorityQueue()

Initializes a new instance of the PriorityQueue class.

PriorityQueue(capacity)

Full Usage: PriorityQueue(capacity)

Parameters:
    capacity : int - The initial capacity.

Initializes a new instance of the PriorityQueue class with a specified initial capacity.

capacity : int

The initial capacity.

Instance members

Instance member Description

this.Count

Full Usage: this.Count

Returns: int

Gets the number of elements in the queue.

Returns: int

this.Dequeue

Full Usage: this.Dequeue

Returns: 'TKey Minimum key value.

Dequeues the minimum key value. An exception is thrown if the queue is empty.

Returns: 'TKey

Minimum key value.

InvalidOperationException Queue is empty

this.Enqueue

Full Usage: this.Enqueue

Parameters:
    val : 'TKey - The key value.

Adds the specified key to the queue.

val : 'TKey

The key value.

this.IsEmpty

Full Usage: this.IsEmpty

Returns: bool

Gets a value indicating whether the queue is empty.

Returns: bool

this.Peek

Full Usage: this.Peek

Returns: 'TKey Minimum key value.

Peeks the element with the minimum key value. An exception is thrown if the queue is empty.

Returns: 'TKey

Minimum key value.

InvalidOperationException Queue is empty.