Constructor UpdatablePriorityQueue
View SourceUpdatablePriorityQueue()
Initializes a new instance of the UpdatablePriorityQueue<TElement, TPriority> class.
Declaration
public UpdatablePriorityQueue()
UpdatablePriorityQueue(int)
Initializes a new instance of the UpdatablePriorityQueue<TElement, TPriority> class with the specified initial capacity.
Declaration
public UpdatablePriorityQueue(int initialCapacity)
Parameters
Type | Name | Description |
---|---|---|
int | initialCapacity | Initial capacity to allocate in the underlying heap array. |
Exceptions
Type | Condition |
---|---|
ArgumentOutOfRangeException | The specified |
UpdatablePriorityQueue(IComparer<TPriority>?)
Initializes a new instance of the UpdatablePriorityQueue<TElement, TPriority> class with the specified custom priority comparer.
Declaration
public UpdatablePriorityQueue(IComparer<TPriority>? priorityComparer)
Parameters
Type | Name | Description |
---|---|---|
IComparer<TPriority> | priorityComparer | Custom comparer dictating the ordering of elements. Uses Default if the argument is null. |
UpdatablePriorityQueue(IEqualityComparer<TElement>?)
Initializes a new instance of the UpdatablePriorityQueue<TElement, TPriority> class with the specified custom priority comparer.
Declaration
public UpdatablePriorityQueue(IEqualityComparer<TElement>? elementComparer)
Parameters
Type | Name | Description |
---|---|---|
IEqualityComparer<TElement> | elementComparer | Custom comparer dictating the equality of two elements. Uses Default if the argument is null. |
UpdatablePriorityQueue(int, IComparer<TPriority>?, IEqualityComparer<TElement>?)
Initializes a new instance of the UpdatablePriorityQueue<TElement, TPriority> class with the specified initial capacity and custom priority comparer.
Declaration
public UpdatablePriorityQueue(int initialCapacity, IComparer<TPriority>? priorityComparer, IEqualityComparer<TElement>? elementComparer)
Parameters
Type | Name | Description |
---|---|---|
int | initialCapacity | Initial capacity to allocate in the underlying heap array. |
IComparer<TPriority> | priorityComparer | Custom comparer dictating the ordering of elements. Uses Default if the argument is null. |
IEqualityComparer<TElement> | elementComparer | Custom comparer dictating the equality of two elements. Uses Default if the argument is null. |
Exceptions
Type | Condition |
---|---|
ArgumentOutOfRangeException | The specified |
UpdatablePriorityQueue(IEnumerable<(TElement Element, TPriority Priority)>)
Initializes a new instance of the UpdatablePriorityQueue<TElement, TPriority> class that is populated with the specified elements and priorities.
Declaration
public UpdatablePriorityQueue(IEnumerable<(TElement Element, TPriority Priority)> items)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<(TElement Element, TPriority Priority)> | items | The pairs of elements and priorities with which to populate the queue. |
Remarks
Constructs the heap using a heapify operation, which is generally faster than enqueuing individual elements sequentially.
Exceptions
Type | Condition |
---|---|
ArgumentNullException | The specified |
UpdatablePriorityQueue(IEnumerable<(TElement Element, TPriority Priority)>, IComparer<TPriority>?, IEqualityComparer<TElement>?)
Initializes a new instance of the UpdatablePriorityQueue<TElement, TPriority> class that is populated with the specified elements and priorities, and with the specified custom priority comparer.
Declaration
public UpdatablePriorityQueue(IEnumerable<(TElement Element, TPriority Priority)> items, IComparer<TPriority>? priorityComparer, IEqualityComparer<TElement>? elementComparer)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<(TElement Element, TPriority Priority)> | items | The pairs of elements and priorities with which to populate the queue. |
IComparer<TPriority> | priorityComparer | Custom comparer dictating the ordering of elements. Uses Default if the argument is null. |
IEqualityComparer<TElement> | elementComparer | Custom comparer dictating the equality of two elements. Uses Default if the argument is null. |
Remarks
Constructs the heap using a heapify operation, which is generally faster than enqueuing individual elements sequentially.
Exceptions
Type | Condition |
---|---|
ArgumentNullException | The specified |