Skip to content

Commit dd7c9cb

Browse files
unknownunknown
authored andcommitted
Initial Commit
0 parents  commit dd7c9cb

42 files changed

Lines changed: 4705 additions & 0 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

README.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
= JavaScript Data Structures
2+
3+
bst.js - a binary search tree
4+
5+
----
6+
7+
Copyright (c) 2011 Trevor Lalish-Menagh. This software is licensed under the MIT License.

doc/files/bst-js.html

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>bst.js</title><link rel="stylesheet" type="text/css" href="../styles/main.css"><script language=JavaScript src="../javascript/main.js"></script><script language=JavaScript src="../javascript/prettify.js"></script></head><body class="FramedContentPage" onLoad="NDOnLoad();prettyPrint();"><script language=JavaScript><!--
2+
if (browserType) {document.write("<div class=" + browserType + ">");if (browserVer) {document.write("<div class=" + browserVer + ">"); }}// --></script>
3+
4+
<!-- Generated by Natural Docs, version 1.51 -->
5+
<!-- http://www.naturaldocs.org -->
6+
7+
<!-- saved from url=(0026)http://www.naturaldocs.org -->
8+
9+
10+
11+
12+
<div id=Content><div class="CFile"><div class=CTopic id=MainTopic><h1 class=CTitle><a name="bst.js"></a>bst.js</h1><div class=CBody><p>A pure JavaScript implementation of a binary search tree.</p><!--START_ND_SUMMARY--><div class=Summary><div class=STitle>Summary</div><div class=SBorder><table border=0 cellspacing=0 cellpadding=0 class=STable><tr class="SMain"><td class=SEntry><a href="#bst.js" >bst.js</a></td><td class=SDescription>A pure JavaScript implementation of a binary search tree.</td></tr><tr class="SClass"><td class=SEntry><a href="#BST" >BST</a></td><td class=SDescription>The binary search tree class.</td></tr><tr class="SGroup SIndent1"><td class=SEntry><a href="#BST.Functions" >Functions</a></td><td class=SDescription></td></tr><tr class="SFunction SIndent2 SMarked"><td class=SEntry><a href="#BST.search" id=link1 onMouseOver="ShowTip(event, 'tt1', 'link1')" onMouseOut="HideTip('tt1')">search</a></td><td class=SDescription>Search through a binary tree.</td></tr><tr class="SFunction SIndent2"><td class=SEntry><a href="#BST.insert" id=link2 onMouseOver="ShowTip(event, 'tt2', 'link2')" onMouseOut="HideTip('tt2')">insert</a></td><td class=SDescription>Insert into a binary tree.</td></tr><tr class="SFunction SIndent2 SMarked"><td class=SEntry><a href="#BST.traverse" id=link3 onMouseOver="ShowTip(event, 'tt3', 'link3')" onMouseOut="HideTip('tt3')">traverse</a></td><td class=SDescription>Call a function on each node of a binary tree.</td></tr><tr class="SFunction SIndent2"><td class=SEntry><a href="#BST.min" id=link4 onMouseOver="ShowTip(event, 'tt4', 'link4')" onMouseOut="HideTip('tt4')">min</a></td><td class=SDescription>Find the key of the node with the lowest key number.</td></tr><tr class="SFunction SIndent2 SMarked"><td class=SEntry><a href="#BST.max" id=link5 onMouseOver="ShowTip(event, 'tt5', 'link5')" onMouseOut="HideTip('tt5')">max</a></td><td class=SDescription>Find the key of the node with the highest key number.</td></tr><tr class="SFunction SIndent2"><td class=SEntry><a href="#BST.successor" id=link6 onMouseOver="ShowTip(event, 'tt6', 'link6')" onMouseOut="HideTip('tt6')">successor</a></td><td class=SDescription>Find the key that successes the root node.</td></tr><tr class="SFunction SIndent2 SMarked"><td class=SEntry><a href="#BST.predecessor" id=link7 onMouseOver="ShowTip(event, 'tt7', 'link7')" onMouseOut="HideTip('tt7')">predecessor</a></td><td class=SDescription>Find the key that preceeds the root node.</td></tr><tr class="SFunction SIndent2"><td class=SEntry><a href="#BST.root" id=link8 onMouseOver="ShowTip(event, 'tt8', 'link8')" onMouseOut="HideTip('tt8')">root</a></td><td class=SDescription>The key of the root node.</td></tr></table></div></div><!--END_ND_SUMMARY--></div></div></div>
13+
14+
<div class="CClass"><div class=CTopic><h2 class=CTitle><a name="BST"></a>BST</h2><div class=CBody><p>The binary search tree class.</p><!--START_ND_SUMMARY--><div class=Summary><div class=STitle>Summary</div><div class=SBorder><table border=0 cellspacing=0 cellpadding=0 class=STable><tr class="SGroup"><td class=SEntry><a href="#BST.Functions" >Functions</a></td><td class=SDescription></td></tr><tr class="SFunction SIndent1 SMarked"><td class=SEntry><a href="#BST.search" id=link9 onMouseOver="ShowTip(event, 'tt1', 'link9')" onMouseOut="HideTip('tt1')">search</a></td><td class=SDescription>Search through a binary tree.</td></tr><tr class="SFunction SIndent1"><td class=SEntry><a href="#BST.insert" id=link10 onMouseOver="ShowTip(event, 'tt2', 'link10')" onMouseOut="HideTip('tt2')">insert</a></td><td class=SDescription>Insert into a binary tree.</td></tr><tr class="SFunction SIndent1 SMarked"><td class=SEntry><a href="#BST.traverse" id=link11 onMouseOver="ShowTip(event, 'tt3', 'link11')" onMouseOut="HideTip('tt3')">traverse</a></td><td class=SDescription>Call a function on each node of a binary tree.</td></tr><tr class="SFunction SIndent1"><td class=SEntry><a href="#BST.min" id=link12 onMouseOver="ShowTip(event, 'tt4', 'link12')" onMouseOut="HideTip('tt4')">min</a></td><td class=SDescription>Find the key of the node with the lowest key number.</td></tr><tr class="SFunction SIndent1 SMarked"><td class=SEntry><a href="#BST.max" id=link13 onMouseOver="ShowTip(event, 'tt5', 'link13')" onMouseOut="HideTip('tt5')">max</a></td><td class=SDescription>Find the key of the node with the highest key number.</td></tr><tr class="SFunction SIndent1"><td class=SEntry><a href="#BST.successor" id=link14 onMouseOver="ShowTip(event, 'tt6', 'link14')" onMouseOut="HideTip('tt6')">successor</a></td><td class=SDescription>Find the key that successes the root node.</td></tr><tr class="SFunction SIndent1 SMarked"><td class=SEntry><a href="#BST.predecessor" id=link15 onMouseOver="ShowTip(event, 'tt7', 'link15')" onMouseOut="HideTip('tt7')">predecessor</a></td><td class=SDescription>Find the key that preceeds the root node.</td></tr><tr class="SFunction SIndent1"><td class=SEntry><a href="#BST.root" id=link16 onMouseOver="ShowTip(event, 'tt8', 'link16')" onMouseOut="HideTip('tt8')">root</a></td><td class=SDescription>The key of the root node.</td></tr></table></div></div><!--END_ND_SUMMARY--></div></div></div>
15+
16+
<div class="CGroup"><div class=CTopic><h3 class=CTitle><a name="BST.Functions"></a>Functions</h3></div></div>
17+
18+
<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="BST.search"></a>search</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters prettyprint "nowrap>search: function (</td><td class="PParameter prettyprint " nowrap>key</td><td class="PAfterParameters prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote><p>Search through a binary tree.</p><h4 class=CHeading>Parameters</h4><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>key</td><td class=CDLDescription>the key to search for.</td></tr></table><h4 class=CHeading>Returns</h4><p>the value of the found node, or null if no node was found, or undefined if no key was specified.</p></div></div></div>
19+
20+
<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="BST.insert"></a>insert</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters prettyprint "nowrap>insert: function (</td><td class="PParameter prettyprint " nowrap>key,</td></tr><tr><td></td><td class="PParameter prettyprint " nowrap>value</td><td class="PAfterParameters prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote><p>Insert into a binary tree.</p><h4 class=CHeading>Parameters</h4><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>key</td><td class=CDLDescription>the key to search for.</td></tr><tr><td class=CDLEntry>value</td><td class=CDLDescription>the value to associate with the key (any type of object).</td></tr></table><h4 class=CHeading>Returns</h4><p>true, or undefined if no key was specified.</p></div></div></div>
21+
22+
<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="BST.traverse"></a>traverse</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters prettyprint "nowrap>traverse: function (</td><td class="PParameter prettyprint " nowrap>callback</td><td class="PAfterParameters prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote><p>Call a function on each node of a binary tree.</p><h4 class=CHeading>Parameters</h4><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>callback</td><td class=CDLDescription>the function to call on each node, this function takes a key and a value as parameters.&nbsp; If no callback is specified, print is called.</td></tr></table><h4 class=CHeading>Returns</h4><p>true.</p></div></div></div>
23+
24+
<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="BST.min"></a>min</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td class="prettyprint">min: function ()</td></tr></table></blockquote><p>Find the key of the node with the lowest key number.</p><h4 class=CHeading>Parameters</h4><p>none</p><h4 class=CHeading>Returns</h4><p>the key of the node with the lowest key number.</p></div></div></div>
25+
26+
<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="BST.max"></a>max</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td class="prettyprint">max: function ()</td></tr></table></blockquote><p>Find the key of the node with the highest key number.</p><h4 class=CHeading>Parameters</h4><p>none</p><h4 class=CHeading>Returns</h4><p>the key of the node with the highest key number.</p></div></div></div>
27+
28+
<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="BST.successor"></a>successor</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td class="prettyprint">successor: function ()</td></tr></table></blockquote><p>Find the key that successes the root node.</p><h4 class=CHeading>Parameters</h4><p>none</p><h4 class=CHeading>Returns</h4><p>the key of the node that successes the root node.</p></div></div></div>
29+
30+
<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="BST.predecessor"></a>predecessor</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td class="prettyprint">predecessor: function ()</td></tr></table></blockquote><p>Find the key that preceeds the root node.</p><h4 class=CHeading>Parameters</h4><p>none</p><h4 class=CHeading>Returns</h4><p>the key of the node that preceeds the root node.</p></div></div></div>
31+
32+
<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="BST.root"></a>root</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td class="prettyprint">root: function ()</td></tr></table></blockquote><p>The key of the root node.</p><h4 class=CHeading>Parameters</h4><p>none</p><h4 class=CHeading>Returns</h4><p>the key of the root node.</p></div></div></div>
33+
34+
</div><!--Content-->
35+
36+
37+
38+
<!--START_ND_TOOLTIPS-->
39+
<div class=CToolTip id="tt1"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters prettyprint "nowrap>search: function (</td><td class="PParameter prettyprint " nowrap>key</td><td class="PAfterParameters prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote>Search through a binary tree.</div></div><div class=CToolTip id="tt2"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters prettyprint "nowrap>insert: function (</td><td class="PParameter prettyprint " nowrap>key,</td></tr><tr><td></td><td class="PParameter prettyprint " nowrap>value</td><td class="PAfterParameters prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote>Insert into a binary tree.</div></div><div class=CToolTip id="tt3"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class="PBeforeParameters prettyprint "nowrap>traverse: function (</td><td class="PParameter prettyprint " nowrap>callback</td><td class="PAfterParameters prettyprint "nowrap>)</td></tr></table></td></tr></table></blockquote>Call a function on each node of a binary tree.</div></div><div class=CToolTip id="tt4"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td class="prettyprint">min: function ()</td></tr></table></blockquote>Find the key of the node with the lowest key number.</div></div><div class=CToolTip id="tt5"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td class="prettyprint">max: function ()</td></tr></table></blockquote>Find the key of the node with the highest key number.</div></div><div class=CToolTip id="tt6"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td class="prettyprint">successor: function ()</td></tr></table></blockquote>Find the key that successes the root node.</div></div><div class=CToolTip id="tt7"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td class="prettyprint">predecessor: function ()</td></tr></table></blockquote>Find the key that preceeds the root node.</div></div><div class=CToolTip id="tt8"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class="Prototype"><tr><td class="prettyprint">root: function ()</td></tr></table></blockquote>The key of the root node.</div></div><!--END_ND_TOOLTIPS-->
40+
41+
<script language=JavaScript><!--
42+
if (browserType) {if (browserVer) {document.write("</div>"); }document.write("</div>");}// --></script></body></html>

doc/index.html

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Frameset//EN" "http://www.w3.org/TR/REC-html40/frameset.dtd"><html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title></title></head>
2+
3+
<!-- Generated by Natural Docs, version 1.51 -->
4+
<!-- http://www.naturaldocs.org -->
5+
6+
<!-- saved from url=(0026)http://www.naturaldocs.org -->
7+
8+
<frameset cols="185,*"><frame name=Menu src="menu.html"><frame name=Content src="files/bst-js.html"></frameset><noframes>This documentation was designed for use with frames. However, you can still use it by <a href="menu.html">starting from the menu page</a>.<script language=JavaScript><!--
9+
location.href="menu.html";
10+
// --></script></noframes></html>

doc/index/Classes.html

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
2+
3+
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>Class Index</title><link rel="stylesheet" type="text/css" href="../styles/main.css"><script language=JavaScript src="../javascript/main.js"></script></head><body class="FramedIndexPage" onLoad="NDOnLoad()"><script language=JavaScript><!--
4+
if (browserType) {document.write("<div class=" + browserType + ">");if (browserVer) {document.write("<div class=" + browserVer + ">"); }}// --></script>
5+
6+
7+
8+
9+
<!-- Generated by Natural Docs, version 1.51 -->
10+
<!-- http://www.naturaldocs.org -->
11+
12+
<!-- saved from url=(0026)http://www.naturaldocs.org -->
13+
14+
15+
16+
17+
<div id=Index><div class=IPageTitle>Class Index</div><div class=INavigationBar>$#! &middot; 0-9 &middot; A &middot; <a href="#B">B</a> &middot; C &middot; D &middot; E &middot; F &middot; G &middot; H &middot; I &middot; J &middot; K &middot; L &middot; M &middot; N &middot; O &middot; P &middot; Q &middot; R &middot; S &middot; T &middot; U &middot; V &middot; W &middot; X &middot; Y &middot; Z</div><table border=0 cellspacing=0 cellpadding=0><tr><td class=IHeading id=IFirstHeading><a name="B"></a>B</td><td></td></tr><tr><td class=ISymbolPrefix id=IOnlySymbolPrefix>&nbsp;</td><td class=IEntry><a href="../files/bst-js.html#BST" id=link1 onMouseOver="ShowTip(event, 'tt1', 'link1')" onMouseOut="HideTip('tt1')" class=ISymbol>BST</a></td></tr></table>
18+
<!--START_ND_TOOLTIPS-->
19+
<div class=CToolTip id="tt1"><div class=CClass>The binary search tree class.</div></div><!--END_ND_TOOLTIPS-->
20+
21+
</div><!--Index-->
22+
23+
24+
<script language=JavaScript><!--
25+
if (browserType) {if (browserVer) {document.write("</div>"); }document.write("</div>");}// --></script></body></html>

doc/index/Files.html

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
2+
3+
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>File Index</title><link rel="stylesheet" type="text/css" href="../styles/main.css"><script language=JavaScript src="../javascript/main.js"></script></head><body class="FramedIndexPage" onLoad="NDOnLoad()"><script language=JavaScript><!--
4+
if (browserType) {document.write("<div class=" + browserType + ">");if (browserVer) {document.write("<div class=" + browserVer + ">"); }}// --></script>
5+
6+
7+
8+
9+
<!-- Generated by Natural Docs, version 1.51 -->
10+
<!-- http://www.naturaldocs.org -->
11+
12+
<!-- saved from url=(0026)http://www.naturaldocs.org -->
13+
14+
15+
16+
17+
<div id=Index><div class=IPageTitle>File Index</div><div class=INavigationBar>$#! &middot; 0-9 &middot; A &middot; <a href="#B">B</a> &middot; C &middot; D &middot; E &middot; F &middot; G &middot; H &middot; I &middot; J &middot; K &middot; L &middot; M &middot; N &middot; O &middot; P &middot; Q &middot; R &middot; S &middot; T &middot; U &middot; V &middot; W &middot; X &middot; Y &middot; Z</div><table border=0 cellspacing=0 cellpadding=0><tr><td class=IHeading id=IFirstHeading><a name="B"></a>B</td><td></td></tr><tr><td class=ISymbolPrefix id=IOnlySymbolPrefix>&nbsp;</td><td class=IEntry><a href="../files/bst-js.html#bst.js" id=link1 onMouseOver="ShowTip(event, 'tt1', 'link1')" onMouseOut="HideTip('tt1')" class=ISymbol>bst.js</a></td></tr></table>
18+
<!--START_ND_TOOLTIPS-->
19+
<div class=CToolTip id="tt1"><div class=CFile>A pure JavaScript implementation of a binary search tree.</div></div><!--END_ND_TOOLTIPS-->
20+
21+
</div><!--Index-->
22+
23+
24+
<script language=JavaScript><!--
25+
if (browserType) {if (browserVer) {document.write("</div>"); }document.write("</div>");}// --></script></body></html>

0 commit comments

Comments
 (0)