binary-search-tree / 0.2.4 last updated a year ago created on May 27th 2013
Install
npm install --save binary-search-tree
Clone
git clone git@github.com:louischatriot/node-binary-search-tree.git
dependencies
| main |
|
underscore | 1.4.4 | MIT |
maintainers
versions
13 total
| 0.2.4 | a year ago | louischatriot |
| 0.2.3 | 2 years ago | louischatriot |
| 0.2.2 | 2 years ago | louischatriot |
| 0.2.1 | 2 years ago | louischatriot |
| 0.2.0 | 2 years ago | louischatriot |
| 0.1.4 | 2 years ago | louischatriot |
| 0.1.3 | 2 years ago | louischatriot |
| 0.1.2 | 2 years ago | louischatriot |
| 0.1.1 | 2 years ago | louischatriot |
| 0.1.0 | 2 years ago | louischatriot |
| 0.0.3 | 2 years ago | louischatriot |
| 0.0.2 | 2 years ago | louischatriot |
| 0.0.1 | 2 years ago | louischatriot |
readme
Binary search trees for Node.js
Two implementations of binary search tree: basic and AVL (a kind of self-balancing binmary search tree). I wrote this module primarily to store indexes for NeDB (a javascript dependency-less database).
Installation and tests
Package name is binary-search-tree.
Usage
The API mainly provides 3 functions: insert, search and delete. If you do not create a unique-type binary search tree, you can store multiple pieces of data for the same key. Doing so with a unique-type BST will result in an error being thrown. Data is always returned as an array, and you can delete all data relating to a given key, or just one piece of data.
There are three optional parameters you can pass the BST constructor, allowing you to enforce a key-uniqueness constraint, use a custom function to compare keys and use a custom function to check whether values are equal. These parameters are all passed in an object.
Uniqueness
Custom key comparison
Custom value checking
License
(The MIT License)
Copyright (c) 2013 Louis Chatriot <louis.chatriot@gmail.com>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.