{"_id":"bintrees","_rev":"3290877","name":"bintrees","description":"Binary Search Trees","dist-tags":{"latest":"1.0.2"},"maintainers":[{"name":"vadimg","email":""}],"time":{"modified":"2024-05-23T06:51:20.000Z","created":"2011-08-03T05:42:00.218Z","1.0.2":"2017-08-05T19:08:36.407Z","1.0.1":"2015-07-24T09:50:18.982Z","1.0.0":"2013-04-27T17:00:09.938Z","0.0.10":"2013-04-21T14:22:22.729Z","0.0.9":"2012-12-22T18:33:02.769Z","0.0.8":"2012-12-22T18:21:28.379Z","0.0.7":"2011-10-28T22:25:01.394Z","0.0.6":"2011-10-28T21:34:36.180Z","0.0.5":"2011-10-28T20:11:04.278Z","0.0.4":"2011-08-03T19:07:09.965Z","0.0.3":"2011-08-03T06:13:16.355Z","0.0.2":"2011-08-03T06:06:46.616Z","0.0.1":"2011-08-03T05:42:00.218Z"},"users":{},"author":{"name":"Vadim Graboys","email":"dimva13@gmail.com"},"repository":{"type":"git","url":"git://github.com/vadimg/js_bintrees.git"},"versions":{"1.0.2":{"author":{"name":"Vadim Graboys","email":"dimva13@gmail.com"},"name":"bintrees","description":"Binary Search Trees","version":"1.0.2","keywords":["binary tree","red black tree","red-black tree","redblack tree"],"license":"MIT","repository":{"type":"git","url":"git://github.com/vadimg/js_bintrees.git"},"directories":{"lib":"lib"},"main":"./index.js","scripts":{"test":"nodeunit ./test/test_*.js && jshint lib/*.js index.js"},"dependencies":{},"devDependencies":{"nodeunit":"0.9.1","jshint":"0.5.9","underscore":"1.3.1","reunion":"0.0.0"},"gitHead":"b36d344bd4f782e91e1eeafb4d00b0908b1b251c","bugs":{"url":"https://github.com/vadimg/js_bintrees/issues"},"homepage":"https://github.com/vadimg/js_bintrees#readme","_id":"bintrees@1.0.2","_shasum":"49f896d6e858a4a499df85c38fb399b9aff840f8","_from":".","_npmVersion":"2.14.7","_nodeVersion":"4.2.2","_npmUser":{"name":"vadimg","email":"dimva13@gmail.com"},"dist":{"shasum":"49f896d6e858a4a499df85c38fb399b9aff840f8","size":1089512,"noattachment":false,"key":"/bintrees/-/bintrees-1.0.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/bintrees/download/bintrees-1.0.2.tgz"},"maintainers":[{"name":"vadimg","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/bintrees-1.0.2.tgz_1501960116111_0.66587526910007"},"publish_time":1501960116407,"_hasShrinkwrap":false,"_cnpm_publish_time":1501960116407,"_cnpmcore_publish_time":"2021-12-16T09:57:01.799Z"},"1.0.1":{"author":{"name":"Vadim Graboys","email":"dimva13@gmail.com"},"name":"bintrees","description":"Binary Search Trees","version":"1.0.1","keywords":["binary tree","red black tree","red-black tree","redblack tree"],"repository":{"type":"git","url":"git://github.com/vadimg/js_bintrees.git"},"directories":{"lib":"lib"},"main":"./index.js","scripts":{"test":"nodeunit ./test/test_*.js && jshint lib/*.js index.js"},"dependencies":{},"devDependencies":{"nodeunit":"0.9.1","jshint":"0.5.9","underscore":"1.3.1","reunion":"0.0.0"},"gitHead":"cfae7fcb27ea2550f9c6aeb81cebef6a37f7783e","bugs":{"url":"https://github.com/vadimg/js_bintrees/issues"},"homepage":"https://github.com/vadimg/js_bintrees","_id":"bintrees@1.0.1","_shasum":"0e655c9b9c2435eaab68bf4027226d2b55a34524","_from":".","_npmVersion":"2.7.3","_nodeVersion":"0.12.1","_npmUser":{"name":"vadimg","email":"dimva13@gmail.com"},"maintainers":[{"name":"vadimg","email":""}],"dist":{"shasum":"0e655c9b9c2435eaab68bf4027226d2b55a34524","size":1088854,"noattachment":false,"key":"/bintrees/-/bintrees-1.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/bintrees/download/bintrees-1.0.1.tgz"},"publish_time":1437731418982,"_hasShrinkwrap":false,"_cnpm_publish_time":1437731418982,"_cnpmcore_publish_time":"2021-12-16T09:57:02.916Z"},"1.0.0":{"author":{"name":"Vadim Graboys","email":"dimva13@gmail.com"},"name":"bintrees","description":"Binary Search Trees","version":"1.0.0","keywords":["binary tree","red black tree","red-black tree","redblack tree"],"repository":{"type":"git","url":"git://github.com/vadimg/js_bintrees.git"},"directories":{"lib":"lib"},"main":"./index.js","scripts":{"test":"nodeunit ./test/test_*.js && jshint lib/*.js index.js"},"dependencies":{},"devDependencies":{"nodeunit":"0.7.4","jshint":"0.5.9","underscore":"1.3.1","reunion":"0.0.0"},"_id":"bintrees@1.0.0","dist":{"shasum":"9ea09a6672c1134b5e8c4313a13e47cca968c720","size":1091564,"noattachment":false,"key":"/bintrees/-/bintrees-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/bintrees/download/bintrees-1.0.0.tgz"},"maintainers":[{"name":"vadimg","email":""}],"publish_time":1367082009938,"_hasShrinkwrap":false,"_cnpm_publish_time":1367082009938,"_cnpmcore_publish_time":"2021-12-16T09:57:04.112Z"},"0.0.10":{"author":{"name":"Vadim Graboys","email":"dimva13@gmail.com"},"name":"bintrees","description":"Binary Search Trees","version":"0.0.10","keywords":["binary tree","red black tree","red-black tree","redblack tree"],"repository":{"type":"git","url":"git://github.com/vadimg/js_bintrees.git"},"directories":{"lib":"lib"},"main":"./index.js","scripts":{"test":"nodeunit ./test/test_*.js && jshint lib/*.js index.js"},"dependencies":{},"devDependencies":{"nodeunit":"0.7.4","jshint":"0.5.9","underscore":"1.3.1","reunion":"0.0.0"},"_id":"bintrees@0.0.10","dist":{"shasum":"95496cf4b6ebcd04428656310197cea86bf5e94b","size":1091533,"noattachment":false,"key":"/bintrees/-/bintrees-0.0.10.tgz","tarball":"http://registry.cnpm.dingdandao.com/bintrees/download/bintrees-0.0.10.tgz"},"maintainers":[{"name":"vadimg","email":""}],"publish_time":1366554142729,"_hasShrinkwrap":false,"_cnpm_publish_time":1366554142729,"_cnpmcore_publish_time":"2021-12-16T09:57:05.115Z"},"0.0.9":{"author":{"name":"Vadim Graboys","email":"dimva13@gmail.com"},"name":"bintrees","description":"Binary Search Trees","version":"0.0.9","keywords":["binary tree","red black tree","red-black tree","redblack tree"],"repository":{"type":"git","url":"git://github.com/vadimg/js_bintrees.git"},"directories":{"lib":"lib"},"main":"./index.js","scripts":{"test":"nodeunit ./test/test_*.js && jshint lib/*.js index.js"},"dependencies":{},"devDependencies":{"nodeunit":"0.7.4","jshint":"0.5.9","underscore":"1.3.1","reunion":"0.0.0"},"readmeFilename":"README.md","_id":"bintrees@0.0.9","dist":{"shasum":"150a24302e147318dd00436007fd51d18e9550ed","size":1087642,"noattachment":false,"key":"/bintrees/-/bintrees-0.0.9.tgz","tarball":"http://registry.cnpm.dingdandao.com/bintrees/download/bintrees-0.0.9.tgz"},"_npmVersion":"1.1.69","_npmUser":{"name":"vadimg","email":"dimva13@gmail.com"},"maintainers":[{"name":"vadimg","email":""}],"publish_time":1356201182769,"_hasShrinkwrap":false,"_cnpm_publish_time":1356201182769,"_cnpmcore_publish_time":"2021-12-16T09:57:06.071Z"},"0.0.8":{"author":{"name":"Vadim Graboys","email":"dimva13@gmail.com"},"name":"bintrees","description":"Binary Search Trees","version":"0.0.8","homepage":"bitfloor.com","keywords":["binary tree","red black tree","red-black tree","redblack tree"],"repository":{"type":"git","url":"git://github.com/vadimg/js_bintrees.git"},"directories":{"lib":"lib"},"main":"./index.js","scripts":{"test":"nodeunit ./test/test_*.js && jshint lib/*.js index.js"},"dependencies":{},"devDependencies":{"nodeunit":"0.7.4","jshint":"0.5.9","underscore":"1.3.1","reunion":"0.0.0"},"readmeFilename":"README.md","_id":"bintrees@0.0.8","dist":{"shasum":"f005f5c4c13793333410059c30401062069aa094","size":1087643,"noattachment":false,"key":"/bintrees/-/bintrees-0.0.8.tgz","tarball":"http://registry.cnpm.dingdandao.com/bintrees/download/bintrees-0.0.8.tgz"},"_npmVersion":"1.1.69","_npmUser":{"name":"vadimg","email":"dimva13@gmail.com"},"maintainers":[{"name":"vadimg","email":""}],"publish_time":1356200488379,"_hasShrinkwrap":false,"_cnpm_publish_time":1356200488379,"_cnpmcore_publish_time":"2021-12-16T09:57:06.993Z"},"0.0.7":{"author":{"name":"Vadim Graboys","email":"dimva13@gmail.com"},"name":"bintrees","description":"Binary Search Trees","version":"0.0.7","homepage":"bitfloor.com","keywords":["binary tree","red black tree","red-black tree","redblack tree"],"repository":{"type":"git","url":"git://github.com/vadimg/js_bintrees.git"},"directories":{"lib":"lib"},"main":"./index.js","scripts":{"test":"./node_modules/.bin/expresso ./test/test_*.js; ./node_modules/.bin/jshint lib/*.js"},"dependencies":{},"devDependencies":{"underscore":">=1.1.7","expresso":">=0.8.1","jshint":">=0.5.2"},"_npmUser":{"name":"vadimg","email":"dimva13@gmail.com"},"_id":"bintrees@0.0.7","engines":{"node":"*"},"_engineSupported":true,"_npmVersion":"1.0.103","_nodeVersion":"v0.5.5","_defaultsLoaded":true,"dist":{"shasum":"c4949ab2d33412c284d5536d2484ebe79ee0751d","size":1084428,"noattachment":false,"key":"/bintrees/-/bintrees-0.0.7.tgz","tarball":"http://registry.cnpm.dingdandao.com/bintrees/download/bintrees-0.0.7.tgz"},"maintainers":[{"name":"vadimg","email":""}],"publish_time":1319840701394,"_hasShrinkwrap":false,"_cnpm_publish_time":1319840701394,"_cnpmcore_publish_time":"2021-12-16T09:57:07.597Z"},"0.0.6":{"author":{"name":"Vadim Graboys","email":"dimva13@gmail.com"},"name":"bintrees","description":"Binary Search Trees","version":"0.0.6","homepage":"bitfloor.com","repository":{"type":"git","url":"git://github.com/vadimg/js_bintrees.git"},"directories":{"lib":"lib"},"main":"./index.js","scripts":{"test":"./node_modules/.bin/expresso ./test/test_*.js; ./node_modules/.bin/nodelint lib/*.js --config ./nodelint_config.js"},"dependencies":{},"devDependencies":{"underscore":">=1.1.7","expresso":">=0.8.1","nodelint":">=0.5.1"},"_npmUser":{"name":"vadimg","email":"dimva13@gmail.com"},"_id":"bintrees@0.0.6","engines":{"node":"*"},"_engineSupported":true,"_npmVersion":"1.0.103","_nodeVersion":"v0.5.5","_defaultsLoaded":true,"dist":{"shasum":"ecf4719982738bb3c377247592ce66e5bed64437","size":1086052,"noattachment":false,"key":"/bintrees/-/bintrees-0.0.6.tgz","tarball":"http://registry.cnpm.dingdandao.com/bintrees/download/bintrees-0.0.6.tgz"},"maintainers":[{"name":"vadimg","email":""}],"publish_time":1319837676180,"_hasShrinkwrap":false,"_cnpm_publish_time":1319837676180,"_cnpmcore_publish_time":"2021-12-16T09:57:08.267Z"},"0.0.5":{"author":{"name":"Vadim Graboys","email":"dimva13@gmail.com"},"name":"bintrees","description":"Binary Search Trees","version":"0.0.5","homepage":"bitfloor.com","repository":{"type":"git","url":"git://github.com/vadimg/js_bintrees.git"},"directories":{"lib":"lib"},"main":"./index.js","scripts":{"test":"./node_modules/.bin/expresso ./test/test_*.js"},"dependencies":{},"devDependencies":{"underscore":">=1.1.7","expresso":">=0.8.1"},"_npmUser":{"name":"vadimg","email":"dimva13@gmail.com"},"_id":"bintrees@0.0.5","engines":{"node":"*"},"_engineSupported":true,"_npmVersion":"1.0.103","_nodeVersion":"v0.5.5","_defaultsLoaded":true,"dist":{"shasum":"44818823e9c1c2e647f5e577f4683d32bf5bc6c0","size":1084683,"noattachment":false,"key":"/bintrees/-/bintrees-0.0.5.tgz","tarball":"http://registry.cnpm.dingdandao.com/bintrees/download/bintrees-0.0.5.tgz"},"maintainers":[{"name":"vadimg","email":""}],"publish_time":1319832664278,"_hasShrinkwrap":false,"_cnpm_publish_time":1319832664278,"_cnpmcore_publish_time":"2021-12-16T09:57:09.123Z"},"0.0.4":{"author":{"name":"Vadim Graboys","email":"dimva13@gmail.com"},"name":"bintrees","description":"Binary Search Trees","version":"0.0.4","homepage":"bitfloor.com","repository":{"type":"git","url":"git://github.com/vadimg/js_bintrees.git"},"directories":{"lib":"lib"},"main":"./lib/index.js","scripts":{"test":"expresso ./test/test_*.js"},"dependencies":{},"devDependencies":{"underscore":">=1.1.7","expresso":">=0.8.1"},"_npmJsonOpts":{"file":"/home/vadim/.npm/bintrees/0.0.4/package/package.json","wscript":false,"contributors":false,"serverjs":false},"_id":"bintrees@0.0.4","engines":{"node":"*"},"_engineSupported":true,"_npmVersion":"1.0.22","_nodeVersion":"v0.4.8","_defaultsLoaded":true,"dist":{"shasum":"11fdd9b308851fe9c76958c5db30649b9f179366","size":1083666,"noattachment":false,"key":"/bintrees/-/bintrees-0.0.4.tgz","tarball":"http://registry.cnpm.dingdandao.com/bintrees/download/bintrees-0.0.4.tgz"},"maintainers":[{"name":"vadimg","email":""}],"publish_time":1312398429965,"_hasShrinkwrap":false,"_cnpm_publish_time":1312398429965,"_cnpmcore_publish_time":"2021-12-16T09:57:09.646Z"},"0.0.3":{"author":{"name":"Vadim Graboys","email":"dimva13@gmail.com"},"name":"bintrees","description":"Binary Search Trees","version":"0.0.3","homepage":"bitfloor.com","repository":{"type":"git","url":"git://github.com/vadimg/js_bintrees.git"},"directories":{"lib":"lib"},"main":"./lib/index.js","scripts":{"test":"expresso ./test/test_*.js"},"engines":{"node":"~v0.4.8"},"dependencies":{},"devDependencies":{"underscore":">=1.1.7","expresso":">=0.8.1"},"_npmJsonOpts":{"file":"/home/vadim/.npm/bintrees/0.0.3/package/package.json","wscript":false,"contributors":false,"serverjs":false},"_id":"bintrees@0.0.3","_engineSupported":true,"_npmVersion":"1.0.22","_nodeVersion":"v0.4.8","_defaultsLoaded":true,"dist":{"shasum":"be22dbe52fbe0ddb062125c788843dc8676ce134","size":1083690,"noattachment":false,"key":"/bintrees/-/bintrees-0.0.3.tgz","tarball":"http://registry.cnpm.dingdandao.com/bintrees/download/bintrees-0.0.3.tgz"},"maintainers":[{"name":"vadimg","email":""}],"publish_time":1312351996355,"_hasShrinkwrap":false,"_cnpm_publish_time":1312351996355,"_cnpmcore_publish_time":"2021-12-16T09:57:10.339Z"},"0.0.2":{"author":{"name":"Vadim Graboys","email":"dimva13@gmail.com"},"name":"bintrees","description":"Binary Search Trees","version":"0.0.2","homepage":"bitfloor.com","repository":{"type":"git","url":"git://github.com/vadimg/js_bintrees.git"},"directories":{"lib":"lib"},"main":"./lib/index.js","scripts":{"test":"expresso ./test/test_*.js"},"engines":{"node":"~v0.4.8"},"dependencies":{},"devDependencies":{"underscore":">=1.1.7","expresso":">=0.8.1"},"_npmJsonOpts":{"file":"/home/vadim/.npm/bintrees/0.0.2/package/package.json","wscript":false,"contributors":false,"serverjs":false},"_id":"bintrees@0.0.2","_engineSupported":true,"_npmVersion":"1.0.22","_nodeVersion":"v0.4.8","_defaultsLoaded":true,"dist":{"shasum":"6cd433cef272827071e746b99fcad23e010caa41","size":1083689,"noattachment":false,"key":"/bintrees/-/bintrees-0.0.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/bintrees/download/bintrees-0.0.2.tgz"},"maintainers":[{"name":"vadimg","email":""}],"publish_time":1312351606616,"_hasShrinkwrap":false,"_cnpm_publish_time":1312351606616,"_cnpmcore_publish_time":"2021-12-16T09:57:11.962Z"},"0.0.1":{"author":{"name":"Vadim Graboys","email":"dimva13@gmail.com"},"name":"bintrees","description":"Binary Search Trees","version":"0.0.1","homepage":"bitfloor.com","repository":{"type":"git","url":"git://github.com/vadimg/js_bintrees.git"},"directories":{"lib":"lib"},"main":"./lib/index.js","scripts":{"test":"expresso ./test/test_*.js"},"engines":{"node":"~v0.4.8"},"dependencies":{},"devDependencies":{"underscore":">=1.1.7","expresso":">=0.8.1"},"_npmJsonOpts":{"file":"/home/vadim/.npm/bintrees/0.0.1/package/package.json","wscript":false,"contributors":false,"serverjs":false},"_id":"bintrees@0.0.1","_engineSupported":true,"_npmVersion":"1.0.22","_nodeVersion":"v0.4.8","_defaultsLoaded":true,"dist":{"shasum":"675c4259dec843f60368387d83680e1025b01159","size":1083646,"noattachment":false,"key":"/bintrees/-/bintrees-0.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/bintrees/download/bintrees-0.0.1.tgz"},"maintainers":[{"name":"vadimg","email":""}],"publish_time":1312350120218,"_hasShrinkwrap":false,"_cnpm_publish_time":1312350120218,"_cnpmcore_publish_time":"2021-12-16T09:57:12.541Z"}},"readme":"Binary Trees [![Build Status](https://secure.travis-ci.org/vadimg/js_bintrees.png?branch=master)](http://travis-ci.org/vadimg/js_bintrees)\n============\n\nThis package provides Binary and Red-Black Search Trees written in Javascript. It is released under the MIT License.\n\nBinary Search Trees are a good way to store data in sorted order. A Red-Black tree is a variation of a Binary Tree that balances itself.\n\nAlgorithms were taken from Julienne Walker: http://eternallyconfuzzled.com/jsw_home.aspx\n\nTrees\n------------\n\n* BinTree - Binary Search Tree\n* RBTree - Red-Black Tree\n\nQuickstart\n------------\nnode.js:\n\n```\nnpm install bintrees\n```\n\n```javascript\nvar RBTree = require('bintrees').RBTree;\n\nvar tree = new RBTree(function(a, b) { return a - b; });\n\ntree.insert(2);\ntree.insert(-3);\n```\n\nsee examples/node.js for more info\n\nIn the browser:\n\n```html\n<script src=\"/path/to/rbtree.js\"></script>\n<script>\n    var tree = new RBTree(function(a, b) { return a - b; });\n    tree.insert(0);\n    tree.insert(1);\n</script>\n```\n\nsee examples/client.html for more info\n\nConstructor\n------------\n\nRequires 1 argument: a comparator function f(a,b) which returns:\n* 0 if a == b\n* >0 if a > b\n* <0 if a < b\n\nMethods\n------------\n\n### insert(item)\n> Inserts the item into the tree. Returns true if inserted, false if duplicate.\n\n### remove(item)\n> Removes the item from the tree. Returns true if removed, false if not found.\n\n### size\n> Number of nodes in the tree.\n\n### clear()\n> Removes all nodes from the tree.\n\n### find(item)\n> Returns node data if found, null otherwise.\n\n### findIter(item)\n> Returns an iterator to the node if found, null otherwise.\n\n### lowerBound(item)\n> Returns an iterator to the tree node at or immediately after the item. Returns null-iterator if tree is empty.\n>> __NOTE: Changed in version 1.0.0 to match C++ lower_bound__\n\n### upperBound(item)\n> Returns an iterator to the tree node immediately after the item. Returns null-iterator if tree is empty.\n>> __NOTE: Changed in version 1.0.0 to match C++ upper_bound__\n\n### min()\n> Returns the min node data in the tree, or null if the tree is empty.\n\n### max()\n> Returns the max node data in the tree, or null if the tree is empty.\n\n### each(f)\n> Calls f on each node's data, in order.\n\n### reach(f)\n> Calls f on each node's data, in reverse order.\n\n### iterator()\n> Returns a null-iterator. See __Iterators__ section below.\n\nIterators\n------------\n\ntree.iterator() will return a null-iterator. On a null iterator,\n* next() will return the first element in the tree\n* prev() will return the last element in the tree\n\nOtherwise,\n* next() will return the next element\n* prev() will return the previous element\n* data() will return the node the iterator is pointing to\n\nWhen iteration reaches the end, the iterator becomes a null-iterator again.\n\nForward iteration example:\n\n```javascript\nvar it=tree.iterator(), item;\nwhile((item = it.next()) !== null) {\n    // do stuff with item\n}\n```\n\nIf you are iterating forward through the tree, you can always call prev() to go back, and vice versa.\n\n__NOTE:__ iterators become invalid when you add or remove elements from the tree.\n\n## Production Usage\n\n* [Coinbase Exchange](https://exchange.coinbase.com/), since Jan 26, 2015.\n* If you are using this in production, please let me know! (add your company to this README in a pull request)\n","_attachments":{},"homepage":"https://github.com/vadimg/js_bintrees#readme","bugs":{"url":"https://github.com/vadimg/js_bintrees/issues"},"license":"MIT"}