Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

bintrees

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bintrees

Binary Search Trees

  • 1.0.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.9M
decreased by-25.12%
Maintainers
1
Weekly downloads
 
Created

What is bintrees?

The bintrees npm package provides data structures for binary search trees, including Red-Black trees and Splay trees. These structures are useful for efficiently storing and retrieving ordered data.

What are bintrees's main functionalities?

Red-Black Tree

This feature allows you to create and manipulate a Red-Black tree, which is a balanced binary search tree. The code sample demonstrates how to create a Red-Black tree, insert elements, and find an element.

const { RBTree } = require('bintrees');

const tree = new RBTree((a, b) => a - b);
tree.insert(5);
tree.insert(3);
tree.insert(7);
console.log(tree.find(3)); // Output: 3
console.log(tree.size); // Output: 3

Splay Tree

This feature allows you to create and manipulate a Splay tree, which is a self-adjusting binary search tree. The code sample demonstrates how to create a Splay tree, insert elements, and find an element.

const { SplayTree } = require('bintrees');

const tree = new SplayTree((a, b) => a - b);
tree.insert(5);
tree.insert(3);
tree.insert(7);
console.log(tree.find(3)); // Output: 3
console.log(tree.size); // Output: 3

Other packages similar to bintrees

Keywords

FAQs

Package last updated on 05 Aug 2017

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

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc