flatten-red-black-tree
Version:
1,014 lines (256 loc) • 11 kB
HTML
<html lang="en">
<head>
<meta charset="utf-8">
<title>RedBlackTree - Documentation</title>
<script src="scripts/prettify/prettify.js"></script>
<script src="scripts/prettify/lang-css.js"></script>
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<link type="text/css" rel="stylesheet" href="https://code.ionicframework.com/ionicons/2.0.1/css/ionicons.min.css">
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
</head>
<body>
<input type="checkbox" id="nav-trigger" class="nav-trigger" />
<label for="nav-trigger" class="navicon-button x">
<div class="navicon"></div>
</label>
<label for="nav-trigger" class="overlay"></label>
<nav>
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="module.exports-RedBlackTree.html">RedBlackTree</a><ul class='methods'><li data-type='method'><a href="module.exports-RedBlackTree.html#find">find</a></li><li data-type='method'><a href="module.exports-RedBlackTree.html#forEach">forEach</a></li><li data-type='method'><a href="module.exports-RedBlackTree.html#insert">insert</a></li><li data-type='method'><a href="module.exports-RedBlackTree.html#remove">remove</a></li></ul></li></ul>
</nav>
<div id="main">
<h1 class="page-title">RedBlackTree</h1>
<section>
<header>
<h2>
RedBlackTree
</h2>
<div class="class-description">Class implementing red-black tree</div>
</header>
<article>
<div class="container-overview">
<h2>Constructor</h2>
<h4 class="name" id="RedBlackTree"><span class="type-signature"></span>new RedBlackTree<span class="signature">()</span><span class="type-signature"></span></h4>
<div class="description">
Construct new instance of red-black tree
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="index.js.html">index.js</a>, <a href="index.js.html#line18">line 18</a>
</li></ul></dd>
</dl>
</div>
<h3 class="subsection-title">Members</h3>
<h4 class="name" id="isEmpty"><span class="type-signature"></span>isEmpty<span class="type-signature"></span></h4>
<div class="description">
Returns true if tree is empty
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="index.js.html">index.js</a>, <a href="index.js.html#line50">line 50</a>
</li></ul></dd>
</dl>
<h4 class="name" id="keys"><span class="type-signature"></span>keys<span class="type-signature"></span></h4>
<div class="description">
Returns arrays of keys stored in the tree
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="index.js.html">index.js</a>, <a href="index.js.html#line40">line 40</a>
</li></ul></dd>
</dl>
<h4 class="name" id="size"><span class="type-signature"></span>size<span class="type-signature"></span></h4>
<div class="description">
Returns size of the tree
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="index.js.html">index.js</a>, <a href="index.js.html#line30">line 30</a>
</li></ul></dd>
</dl>
<h3 class="subsection-title">Methods</h3>
<h4 class="name" id="find"><span class="type-signature"></span>find<span class="signature">(key, value)</span><span class="type-signature"> → {value|undefined}</span></h4>
<div class="description">
Find value stored in the tree by given key. Returns value is key found,
otherwise returns undefined
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>key</code></td>
<td class="type">
<span class="param-type">*</span>
</td>
<td class="description last">key object</td>
</tr>
<tr>
<td class="name"><code>value</code></td>
<td class="type">
<span class="param-type">*</span>
</td>
<td class="description last"></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="index.js.html">index.js</a>, <a href="index.js.html#line74">line 74</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl class="param-type">
<dt>
Type
</dt>
<dd>
<span class="param-type">value</span>
|
<span class="param-type">undefined</span>
</dd>
</dl>
<h4 class="name" id="forEach"><span class="type-signature"></span>forEach<span class="signature">(visitor)</span><span class="type-signature"></span></h4>
<div class="description">
Iterate through entries stored in the tree
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>visitor</code></td>
<td class="type">
<span class="param-type">function</span>
</td>
<td class="description last"></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="index.js.html">index.js</a>, <a href="index.js.html#line102">line 102</a>
</li></ul></dd>
</dl>
<h4 class="name" id="insert"><span class="type-signature"></span>insert<span class="signature">(key, value)</span><span class="type-signature"> → {Node}</span></h4>
<div class="description">
Insert entry {key[,value]} into the red-black tree
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>key</code></td>
<td class="type">
<span class="param-type">*</span>
</td>
<td class="description last">key object, fit to traits interface</td>
</tr>
<tr>
<td class="name"><code>value</code></td>
<td class="type">
<span class="param-type">*</span>
</td>
<td class="description last">(optional) value object</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="index.js.html">index.js</a>, <a href="index.js.html#line60">line 60</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
- reference to inserted node
</div>
<dl class="param-type">
<dt>
Type
</dt>
<dd>
<span class="param-type">Node</span>
</dd>
</dl>
<h4 class="name" id="remove"><span class="type-signature"></span>remove<span class="signature">(key, value)</span><span class="type-signature"> → {boolean}</span></h4>
<div class="description">
Remove entry {key,value} stored in the tree
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>key</code></td>
<td class="type">
</td>
<td class="description last"></td>
</tr>
<tr>
<td class="name"><code>value</code></td>
<td class="type">
</td>
<td class="description last"></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="index.js.html">index.js</a>, <a href="index.js.html#line86">line 86</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl class="param-type">
<dt>
Type
</dt>
<dd>
<span class="param-type">boolean</span>
</dd>
</dl>
</article>
</section>
</div>
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a> on Fri Mar 31 2017 20:18:17 GMT+0300 (Jerusalem Daylight Time) using the Minami theme.
</footer>
<script>prettyPrint();</script>
<script src="scripts/linenumber.js"></script>
</body>
</html>