{"id":19111440,"url":"https://github.com/ekliptor/bintrees-local","last_synced_at":"2026-04-20T19:31:38.237Z","repository":{"id":97211300,"uuid":"135126892","full_name":"Ekliptor/bintrees-local","owner":"Ekliptor","description":"Binary Search Trees","archived":false,"fork":false,"pushed_at":"2018-05-28T07:42:53.000Z","size":1069,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-10-06T14:56:19.895Z","etag":null,"topics":["binary-search","binary-trees","javascript","nodejs"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Ekliptor.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-05-28T07:42:42.000Z","updated_at":"2018-05-28T07:43:24.000Z","dependencies_parsed_at":"2023-03-24T12:19:44.146Z","dependency_job_id":null,"html_url":"https://github.com/Ekliptor/bintrees-local","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Ekliptor/bintrees-local","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ekliptor%2Fbintrees-local","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ekliptor%2Fbintrees-local/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ekliptor%2Fbintrees-local/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ekliptor%2Fbintrees-local/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Ekliptor","download_url":"https://codeload.github.com/Ekliptor/bintrees-local/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ekliptor%2Fbintrees-local/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32062275,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-20T11:35:06.609Z","status":"ssl_error","status_checked_at":"2026-04-20T11:34:48.899Z","response_time":94,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["binary-search","binary-trees","javascript","nodejs"],"created_at":"2024-11-09T04:28:32.982Z","updated_at":"2026-04-20T19:31:38.211Z","avatar_url":"https://github.com/Ekliptor.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"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\nFork\n------------\nFork of this package - please read the docs there: https://github.com/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\u003cscript src=\"/path/to/rbtree.js\"\u003e\u003c/script\u003e\n\u003cscript\u003e\n    var tree = new RBTree(function(a, b) { return a - b; });\n    tree.insert(0);\n    tree.insert(1);\n\u003c/script\u003e\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* \u003e0 if a \u003e b\n* \u003c0 if a \u003c b\n\nMethods\n------------\n\n### insert(item)\n\u003e Inserts the item into the tree. Returns true if inserted, false if duplicate.\n\n### remove(item)\n\u003e Removes the item from the tree. Returns true if removed, false if not found.\n\n### size\n\u003e Number of nodes in the tree.\n\n### clear()\n\u003e Removes all nodes from the tree.\n\n### find(item)\n\u003e Returns node data if found, null otherwise.\n\n### findIter(item)\n\u003e Returns an iterator to the node if found, null otherwise.\n\n### lowerBound(item)\n\u003e Returns an iterator to the tree node at or immediately after the item. Returns null-iterator if tree is empty.\n\u003e\u003e __NOTE: Changed in version 1.0.0 to match C++ lower_bound__\n\n### upperBound(item)\n\u003e Returns an iterator to the tree node immediately after the item. Returns null-iterator if tree is empty.\n\u003e\u003e __NOTE: Changed in version 1.0.0 to match C++ upper_bound__\n\n### min()\n\u003e Returns the min node data in the tree, or null if the tree is empty.\n\n### max()\n\u003e Returns the max node data in the tree, or null if the tree is empty.\n\n### each(f)\n\u003e Calls f on each node's data, in order.\n\n### reach(f)\n\u003e Calls f on each node's data, in reverse order.\n\n### iterator()\n\u003e 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","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fekliptor%2Fbintrees-local","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fekliptor%2Fbintrees-local","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fekliptor%2Fbintrees-local/lists"}