Socket
Book a DemoInstallSign in
Socket

data-balanced-tree

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

data-balanced-tree

Efficient balanced tree implementation in TypeScript

0.1.0
latest
Source
npmnpm
Version published
Maintainers
1
Created
Source

Balanced Tree

Efficient balanced tree implementation in TypeScript

Installation

npm install --save data-balanced-tree

Usage

Note This project comes with typescript definition files right out of the box. Type away!

import { BalancedTree, DefaultComparators } from 'data-balanced-tree';

const tree = new BalancedTree<number>( DefaultComparators.numbers );

tree.insert( 1 );
tree.insert( 2 );
tree.insert( 4 );
tree.insert( 3 );

tree.delete( 2 );

Array.from( tree ); // [ 1, 3, 4 ]
tree.first(); // 1
tree.last(); // 4
tree.between( 1, 3 ); // Iterator 1, 3
tree.between( 2, 4, false );  // Iterator 3
tree.smallestUnder( 2 );  // 1
tree.smallestAbove( 2 ); // 3
tree.biggestAbove( 2 );  // 4
tree.biggestUnder( 2 ); // 1

Keywords

js

FAQs

Package last updated on 20 Apr 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.