Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Heap<T>

A basic implementation of a min-heap

Type parameters

Hierarchy

  • Heap

Index

Constructors

constructor

  • new Heap(maxHeapSize: number): Heap

Properties

Private heapSize

heapSize: number

Private items

items: T[]

Private maxHeapSize

maxHeapSize: number

Accessors

count

  • get count(): number

Methods

add

  • add(item: T): void

contains

  • contains(item: T): boolean

removeFirst

  • removeFirst(): T

Private sortDown

  • sortDown(item: T): void

Private sortUp

  • sortUp(item: T): void

Private swap

  • swap(itemA: T, itemB: T): void

update

  • update(item: T): void

Generated using TypeDoc