UNPKG

ibowankenobi-mergesort

Version:

Merge Sort algorithm implementation without recursion, using cached binary trees

269 lines (88 loc) 3.67 kB
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>JSDoc: Namespace: instance</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="styles/prettify-tomorrow.css"> <link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css"> </head> <body> <div id="main"> <h1 class="page-title">Namespace: instance</h1> <section> <header> <h2><span class="attribs"><span class="type-signature"></span></span> <span class="ancestors"><a href="module-Mergesort.html">Mergesort</a>~</span>instance<span class="signature">(ArrayToBeSorted, Compare)</span><span class="type-signature"> &rarr; {Array}</span></h2> </header> <article> <div class="container-overview"> <div class="description"> <pre class="prettyprint source lang-javascript"><code>let instance = Mergesort(), inputArray = [{value:10},{value:1},{value:5}], compare = (a, b) => a.value - b.value; instance(inputArray, compare); //[{value:1}, ...]</code></pre> </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>ArrayToBeSorted</code></td> <td class="type"> <span class="param-type">Array</span> </td> <td class="description last"><p>Input array to be sorted</p></td> </tr> <tr> <td class="name"><code>Compare</code></td> <td class="type"> <span class="param-type">function</span> </td> <td class="description last"><p>compare function, same as in <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort">here</a></p></td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="mergesort.0.0.3.evergreen.js.html">mergesort.0.0.3.evergreen.js</a>, <a href="mergesort.0.0.3.evergreen.js.html#line288">line 288</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> <p>input array</p> </div> <dl> <dt> Type </dt> <dd> <span class="param-type">Array</span> </dd> </dl> </div> </article> </section> </div> <nav> <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-Mergesort.html">Mergesort</a></li></ul><h3>Namespaces</h3><ul><li><a href="module-Mergesort-instance.html">instance</a></li></ul> </nav> <br class="clear"> <footer> Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.7</a> on Tue Aug 10 2021 13:57:42 GMT+0200 (Central European Summer Time) </footer> <script> prettyPrint(); </script> <script src="scripts/linenumber.js"> </script> </body> </html>