Click or drag to resize

PriorityQueueTEnqueue Method

Namespace:  Ookii.Collections.Generic
Assembly:  Ookii.Collections.Generic (in Ookii.Collections.Generic.dll) Version: 1.0.0.0 (1.0.0.0)
Syntax
public void Enqueue(
	T item
)

Parameters

item
Type: T
The object to add to the queue. The value can be for reference types.
Remarks

PriorityQueueT accepts as a valid value for reference types and allows duplicate elements.

The new element's position is determined by the IComparableT implementation used to compare elements. If the new element is smaller than the current first element in the PriorityQueueT, the new element will become the first element in the queue. Otherwise, the existing first element will remain the first element.

If Count already equals Capacity, the capacity of the PriorityQueueT is increased by automatically reallocating the internal array, and the existing elements are copied to the new array before the new element is added.

If Count is less than Capacity, this method is an O(log n) operation, where n is Count. If the capacity needs to be increased to accommodate the new element, this method becomes an O(n) operation, where n is Count.

See Also