Click or drag to resize

PriorityQueueT Class

A priority queue. It will return the value with the highest priority/compare value first. Multiple occurences of the same object/compare value is allowed.

You can update an element in the priority queue, thereby reposition it in the queue. Save the PriorityQueueTNode returned by Enqueue(T), and updated the value by setting the Value.

Remarks
It is based on a balanced heap data structure (a list handled as a tree structure).

In cases where priority value equals, it does first-in-first-out.

Performance: It has O(log(n)) enqueueing, dequeueing and updating of key.

Inheritance Hierarchy
SystemObject
  DHI.Mike1D.GenericPriorityQueueT

Namespace:  DHI.Mike1D.Generic
Assembly:  DHI.Mike1D.Generic (in DHI.Mike1D.Generic.dll) Version: 19.0.0.0 (11.1.1.1111)
Syntax
public class PriorityQueue<T>

Type Parameters

T

[Missing <typeparam name="T"/> documentation for "T:DHI.Mike1D.Generic.PriorityQueue`1"]

The PriorityQueueT type exposes the following members.

Constructors
Properties
  NameDescription
Public propertyCount
Current number of elements in queue
Public propertyFirst
Take a look at the first element in the queue, without dequeue'ing
Public propertyFirstNode
Take a look at the first element in the queue, without dequeue'ing, returning the priority key node
Top
Methods
  NameDescription
Public methodClear
Clears and empties queue.
Public methodDequeue
Take the first element out of the queue and return it. the first element is the one with the largest key.
Public methodEnqueue
Add a new element to the queue, with the given priority
Public methodEquals
Determines whether the specified object is equal to the current object.
(Inherited from Object.)
Protected methodFinalize
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object.)
Public methodGetHashCode
Serves as the default hash function.
(Inherited from Object.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Public methodToArray
Copies the elements of the priority queue to a new array, sorts it and returns it in priority order.

This is an O(n log(n)) operation

Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Top
See Also