Options
All
  • Public
  • Public/Protected
  • All
Menu

Class PriorityQueue<T>

class

PriorityQueue a min priority queue backed by a pairing heap

Type parameters

  • T

Hierarchy

  • PriorityQueue

Index

Constructors

Properties

Methods

Constructors

constructor

  • Parameters

    • lessThan: function
        • (a: T, b: T): boolean
        • Parameters

          • a: T
          • b: T

          Returns boolean

    Returns PriorityQueue

Properties

Private root

root: PairingHeap<T>

Methods

count

  • count(): number
  • method

    count

    Returns number

    number of elements in queue

empty

  • empty(): boolean
  • method

    empty

    Returns boolean

    true if no more elements in queue

forEach

  • forEach(f: any): void
  • method

    forEach apply f to each element of the queue

    Parameters

    • f: any

      function to apply

    Returns void

isHeap

  • isHeap(): boolean
  • method

    isHeap check heap condition (for testing)

    Returns boolean

    true if queue is in valid state

pop

  • pop(): T
  • method

    pop remove and return the min element from the queue

    Returns T

push

  • method

    push put things on the heap

    Parameters

    • Rest ...args: T

    Returns PairingHeap<T>

reduceKey

  • reduceKey(heapNode: PairingHeap<T>, newKey: T, setHeapNode?: function): void
  • method

    reduceKey reduce the key value of the specified heap node

    Parameters

    Returns void

toString

  • toString(selector: any): string
  • Parameters

    • selector: any

    Returns string

top

  • top(): T
  • method

    top

    Returns T

    the top element (the min element as defined by lessThan)

Generated using TypeDoc