Logos DX
    Preparing search index...

    Class PriorityQueue<T>

    A pure data structure that maintains a set of ordered items by numeric priority. Lower priority numbers dequeue first. Ties are broken by insertion order.

    Time Complexity:

    • Enqueue: O(log n)
    • Dequeue: O(log n)
    • Peek: O(1)

    Space Complexity: O(n) where n is the number of items in the queue

    Type Parameters

    • T
    Index

    Constructors

    Methods

    • Adds a new item into the queue.

      Parameters

      • value: T

        The payload associated with the item

      • priority: number = 0

        Numeric priority (lower = higher priority)

        Time Complexity: O(log n) Space Complexity: O(1)

      Returns void