diff options
| author | Julie Lala <jules@okfoc.us> | 2014-04-15 20:15:31 -0400 |
|---|---|---|
| committer | Julie Lala <jules@okfoc.us> | 2014-04-15 20:15:31 -0400 |
| commit | 1e0cefea2daa2f757e9bd8c824c75b77c368ca07 (patch) | |
| tree | 265c3576590c267da3437d092569c2b442d2178f /tree.js | |
| parent | 28da2a26238ff76f87f4e086a9832a5478c35b23 (diff) | |
| parent | 9c3c0151cb2b0a824f184501ea2672ef9e87a993 (diff) | |
merge
Diffstat (limited to 'tree.js')
| -rw-r--r-- | tree.js | 24 |
1 files changed, 0 insertions, 24 deletions
diff --git a/tree.js b/tree.js deleted file mode 100644 index 8229cae..0000000 --- a/tree.js +++ /dev/null @@ -1,24 +0,0 @@ -var tree = function(n, data){ - this.lo = null - this.hi = null - this.value = n - this.data = data -} -tree.prototype.find = function(n){ - if (n == this.value) return this - if (n < this.value) return this.lo ? this.lo.find(n) : this - if (n > this.value) return this.hi ? this.hi.find(n) : this -} -tree.prototype.add = function(n, data){ - var closest = this.find(n) - if (n == closest.value) return - if (n < closest.value) closest.lo = new tree(n, data) - if (n > closest.value) closest.hi = new tree(n, data) -} -tree.prototype.toString = function(){ - var s = ""; - if (this.lo) s += this.lo.toString() - s += this.value + "," - if (this.hi) s += this.hi.toString() - return s -} |
