Socket
Socket
Sign inDemoInstall

beetree

Package Overview
Dependencies
0
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    beetree

## A simple implementation of a binary search tree that can be balanced on demand


Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Install size
4.60 kB
Created
Weekly downloads
 

Readme

Source

BeeTree

A simple implementation of a binary search tree that can be balanced on demand

npm install --save beetree
var Tree = require('beetree');

var bst = new Tree;
bst.push(1, {foo: 'bar'});
bst.push(5, {chew: 'bacca'});
bst.push(3, {foo: 'baz'});
console.log('THE TREE:', JSON.stringify(bst, null, 4));
console.log('A SEARCH:', JSON.stringify(bst.find(5), null, 4));
console.log('GETTER:', bst.find(5).get('chew'));
bst.balance();
console.log(JSON.stringify(bst, null, 4));
bst.delete(5);
console.log(JSON.stringify(bst, null, 4));

Complexity

  1. .push - O(log n)
  2. .find - O(log n)
  3. .balance - O(n log n) || O(n^3)
  4. .delete - O(log n)

FAQs

Last updated on 04 Jun 2017

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc