SuperLinq SuperLinq
SuperLinq SuperLinq
DocFX + Singulink = ♥

Search Results for

    Class UpdatablePriorityQueue<TElement, TPriority>

    Represents a min priority queue.

    Inheritance
    object
    UpdatablePriorityQueue<TElement, TPriority>
    Inherited Members
    object.GetType()
    object.ToString()
    object.Equals(object)
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetHashCode()
    Namespace: SuperLinq.Collections
    Assembly: SuperLinq.dll
    Syntax
    public sealed class UpdatablePriorityQueue<TElement, TPriority>
    Type Parameters
    Name Description
    TElement

    Specifies the type of elements in the queue.

    TPriority

    Specifies the type of priority associated with enqueued elements.

    Remarks

    Implements an array-backed quaternary min-heap. Each element is enqueued with an associated priority that determines the dequeue order: elements with the lowest priority get dequeued first.

    Constructors

    Name Description
    UpdatablePriorityQueue()

    Initializes a new instance of the UpdatablePriorityQueue<TElement, TPriority> class.

    UpdatablePriorityQueue(IComparer<TPriority>?)

    Initializes a new instance of the UpdatablePriorityQueue<TElement, TPriority> class with the specified custom priority comparer.

    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.

    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.

    UpdatablePriorityQueue(IEqualityComparer<TElement>?)

    Initializes a new instance of the UpdatablePriorityQueue<TElement, TPriority> class with the specified custom priority comparer.

    UpdatablePriorityQueue(int)

    Initializes a new instance of the UpdatablePriorityQueue<TElement, TPriority> class with the specified initial capacity.

    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.

    Properties

    Name Description
    Comparer

    Gets the priority comparer used by the UpdatablePriorityQueue<TElement, TPriority>.

    Count

    Gets the number of elements contained in the UpdatablePriorityQueue<TElement, TPriority>.

    UnorderedItems

    Gets a collection that enumerates the elements of the queue in an unordered manner.

    Methods

    Name Description
    Clear()

    Removes all items from the UpdatablePriorityQueue<TElement, TPriority>.

    Dequeue()

    Removes and returns the minimal element from the UpdatablePriorityQueue<TElement, TPriority>.

    Enqueue(TElement, TPriority)

    Adds or updates the specified element with associated priority to the UpdatablePriorityQueue<TElement, TPriority>.

    EnqueueDequeue(TElement, TPriority)

    Adds the specified element with associated priority to the UpdatablePriorityQueue<TElement, TPriority>, and immediately removes the minimal element, returning the result.

    EnqueueMinimum(TElement, TPriority)

    Adds or updates the specified element with associated priority to the UpdatablePriorityQueue<TElement, TPriority>, using the lessor of the existing or the new priority.

    EnqueueRange(IEnumerable<(TElement Element, TPriority Priority)>)

    Enqueues a sequence of element/priority pairs to the UpdatablePriorityQueue<TElement, TPriority>.

    EnqueueRange(IEnumerable<TElement>, TPriority)

    Enqueues a sequence of elements pairs to the UpdatablePriorityQueue<TElement, TPriority>, all associated with the specified priority.

    EnqueueRangeMinimum(IEnumerable<(TElement Element, TPriority Priority)>)

    Enqueues a sequence of element/priority pairs to the UpdatablePriorityQueue<TElement, TPriority>.

    EnqueueRangeMinimum(IEnumerable<TElement>, TPriority)

    Enqueues a sequence of elements pairs to the UpdatablePriorityQueue<TElement, TPriority>, all associated with the specified priority.

    EnsureCapacity(int)

    Ensures that the UpdatablePriorityQueue<TElement, TPriority> can hold up to capacity items without further expansion of its backing storage.

    Peek()

    Returns the minimal element from the UpdatablePriorityQueue<TElement, TPriority> without removing it.

    TrimExcess()

    Sets the capacity to the actual number of items in the UpdatablePriorityQueue<TElement, TPriority>, if that is less than 90 percent of current capacity.

    TryDequeue(out TElement, out TPriority)

    Removes the minimal element from the UpdatablePriorityQueue<TElement, TPriority>, and copies it to the element parameter, and its associated priority to the priority parameter.

    TryPeek(out TElement, out TPriority)

    Returns a value that indicates whether there is a minimal element in the UpdatablePriorityQueue<TElement, TPriority>, and if one is present, copies it to the element parameter, and its associated priority to the priority parameter. The element is not removed from the UpdatablePriorityQueue<TElement, TPriority>.

    © SuperLinq Authors. All rights reserved.