Options
All
  • Public
  • Public/Protected
  • All
Menu

Class PriorityQueue

Priority Queue

Internally heap Heap data structure is used to implement this queue.

Example

// optional: compare function to determine the priority
// if not provided, priority is done simply with `a < b` operator 
const ds = new PriorityQueue(); 

ds.enqueue(1); 
ds.dequeue();

Hierarchy

  • PriorityQueue

Index

Constructors

Properties

Accessors

Methods

Constructors

constructor

Properties

Private _

_: Heap

Accessors

size

  • get size(): number

Methods

dequeue

  • dequeue(): any

enqueue

  • enqueue(data: any): number
  • Enqueue an element to queue

    Parameters

    • data: any

    Returns number

    size of queue after added an element

peek

  • peek(): any

toArray

  • toArray(): any[]

Generated using TypeDoc