Method EnqueueDequeue
View SourceEnqueueDequeue(TElement, TPriority)
Adds the specified element with associated priority to the UpdatablePriorityQueue<TElement, TPriority>, and immediately removes the minimal element, returning the result.
Declaration
public TElement EnqueueDequeue(TElement element, TPriority priority)
Parameters
Type | Name | Description |
---|---|---|
TElement | element | The element to add to the UpdatablePriorityQueue<TElement, TPriority>. |
TPriority | priority | The priority with which to associate the new element. |
Returns
Type | Description |
---|---|
TElement | The minimal element removed after the enqueue operation. |
Remarks
Implements an insert-then-extract heap operation that is generally more efficient than sequencing Enqueue and Dequeue operations: in the worst case scenario only one sift-down operation is required.