Skip to main content
Module

x/collections/mod.ts

Collection data structures that are not standard built-in objects in JavaScript. This includes a vector (double-ended queue), binary heap (priority queue), binary search tree, and a red black tree.
Very Popular
Latest
import * as collections from "https://deno.land/x/collections@0.12.1/mod.ts";

Classes

c
BinaryHeap
deprecated

A priority queue implemented with a binary heap. The heap is in decending order by default, using JavaScript's built in comparison operators to sort the values.

c
BSTree
deprecated

A unbalanced binary search tree. The values are in ascending order by default, using JavaScript's built in comparison operators to sort the values.

c
RBTree
deprecated

A red-black tree. The values are in ascending order by default, using JavaScript's built in comparison operators to sort the values.

c
Vector
deprecated

A double-ended queue implemented with a growable ring buffer. Vector is faster than JavaScript's built in Array class for shifting and unshifting because it only requires reallocation when increasing the capacity.

Functions

Compares its two arguments for ascending order using JavaScript's built in comparison operators.

Counts the number of occurances for each value.

Compares its two arguments for descending order using JavaScript's built in comparison operators.

Returns a random integer within a range.

Generates an array of integers within a range.

Shuffles an array in-place using the Fisher-Yates shuffle algorithm then returns it.

Swaps the values at two indexes in an array.