https://github.com/devinus/canary
A passerine CommonJS binary search tree implementation
https://github.com/devinus/canary
Last synced: 10 months ago
JSON representation
A passerine CommonJS binary search tree implementation
- Host: GitHub
- URL: https://github.com/devinus/canary
- Owner: devinus
- License: isc
- Created: 2010-10-27T23:20:19.000Z (over 15 years ago)
- Default Branch: master
- Last Pushed: 2010-10-27T23:21:25.000Z (over 15 years ago)
- Last Synced: 2025-07-26T14:17:04.563Z (10 months ago)
- Language: JavaScript
- Homepage: http://github.com/devinus/canary
- Size: 97.7 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Canary - A passerine CommonJS binary search tree implementation
===============================================================
I wrote this library not for anything useful, but just as
a learning experience.
## Usage
$ cd /path/to/canary
$ node repl.js
canary> var tree = new BinarySearchTree();
canary> tree.addAll([9, 5, 2, 4, 6]);
canary> var node2 = tree.find(2);
canary> node2
{ left: null,
right: { left: null, right: null, key: 4, parent: [Circular] },
key: 2,
parent:
{ left: [Circular],
right: { left: null, right: null, key: 6, parent: [Circular] },
key: 5,
parent: { left: [Circular], right: null, key: 9, parent: null } } }