Click or drag to resize

BinaryHeapPriorityQueueTElement Class

Priority queue class based on a binary heap which is set as a max heap, as a priority queue always has the element with the highest value (key) as the first element
Inheritance Hierarchy
SystemObject
  SD.Tools.Algorithmia.PriorityQueuesPriorityQueueBaseTElement
    SD.Tools.Algorithmia.PriorityQueuesBinaryHeapPriorityQueueTElement

Namespace:  SD.Tools.Algorithmia.PriorityQueues
Assembly:  SD.Tools.Algorithmia (in SD.Tools.Algorithmia.dll) Version: 1.3.3.0 (1.3.18.0209)
Syntax
public class BinaryHeapPriorityQueue<TElement> : PriorityQueueBase<TElement>
where TElement : class

Type Parameters

TElement
The type of the elements in the queue

The BinaryHeapPriorityQueueTElement type exposes the following members.

Constructors
  NameDescription
Public methodBinaryHeapPriorityQueueTElement
Initializes a new instance of the BinaryHeapPriorityQueueTElement class.
Top
Properties
Methods
  NameDescription
Public methodAdd
Adds the specified element to the queue
(Overrides PriorityQueueBaseTElementAdd(TElement).)
Public methodClear
Clears the queue.
(Overrides PriorityQueueBaseTElementClear.)
Public methodContains
Determines whether the queue contains the element specified
(Overrides PriorityQueueBaseTElementContains(TElement).)
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.)
Protected methodGetEnumerator
Throws a NotSupportException, as binary heaps can't be enumerated.
(Overrides PriorityQueueBaseTElementGetEnumerator.)
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 methodPeek
Peeks at the first element of the queue (the one with the highest priority, according to the priority comparison) and returns that element without removing it
(Overrides PriorityQueueBaseTElementPeek.)
Public methodRemove
Removes the first element from the queue, if the queue isn't empty.
(Overrides PriorityQueueBaseTElementRemove.)
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Top
Explicit Interface Implementations
Remarks
Heaps don't allow enumeration (as enumeration destroys the heap as the elements have to be extracted), so enumerating this priority queue will throw an exception.

Heaps can't store value types. This is because changing a value type really makes it a different value, while changing the contents of an object doesn't make it a different object. This priority queue, based on a heap, can't store value types either.

See Also