Skip to main content
Module

x/heap/heap.ts

Heap data structure written in TypeScript/Deno
Latest
import * as mod from "https://deno.land/x/heap@0.0.1-pre.0/heap.ts";

Functions

A Heap: i.e. a collection of sorted values that supports the following operations:

  • buildHeap - Create Heap from initialValues in O(n) time
  • length - get number of items in collection in O(1) time
  • peek - get first item in collection in O(1) time
  • pop - remove the first item in collection in O(log(n)) time
  • push - add a new item to the collection in O(log(n)) time

Heap that supports popping the max item.