Class PriorityQueue<T>Internal

Priority queue.

Type Parameters

  • T

    Type of priority queue data.

Constructors

Properties

bucketSize: number

Prioritized bucket size.

maxSize: number

The maximum size of the priority queue.

nodeArray: PriorityQueueNode<T>[]
size: number

The size of the priority queue.

Accessors

Methods

  • Decrements the size of the priority queue.

    Returns number

    The new size of the priority queue.

  • Dequeue data from the priority queue.

    Parameters

    • bucket: number = 0

      The prioritized bucket to dequeue from.

    Returns undefined | T

    The dequeued data or undefined if the priority queue is empty.

    Default Value

    0
    
  • Enqueue data into the priority queue.

    Parameters

    • data: T

      Data to enqueue.

    • Optional priority: number

      Priority of the data. Lower values have higher priority.

    Returns number

    The new size of the priority queue.

  • Increments the size of the priority queue.

    Returns number

    The new size of the priority queue.

  • Peeks at the first data.

    Returns undefined | T

    The first data or undefined if the priority queue is empty.

  • Peeks at the last data.

    Returns undefined | T

    The last data or undefined if the priority queue is empty.