Classic algorithms and data structures in CoffeeScript.
Can be used in either NodeJS (server-side JS) or in the Browser (client-side JS).
Algorithms implemented so far:It uses Mocha as the Testing Framework, Chai as the Assertion Library and CoffeeLint as the Style Checker Library.
Data Structures:
Graph:
Math:
Search:
Sorting:
String:
To use the library on a NodeJS project just install it with npm
:
Globally:
npm -g install algorithms.coffee
or Locally in the project's directory:
npm install algorithms.coffee
And use the require to use the functions.
Example:
var myVariable = require('algorithms.coffee'); var sortedArray = myVariable.insertionSort([3, 1, 2]);
To use the library in standard client-side JavaScript just download the js file contained in the ./dist/ then include it like any other .js.
<script src="algorithms.coffee.js"></script>
Or the minified version
<script src="algorithms.coffee.min.js"></script>
All the library features are available through the global variable algCoffee.
var array = [10, 80, 300, 500, 11, 2, 333]; algCoffee.mergeSort(array); var anotherArray = [30, 20, 1, 3, 99, 667]; var heap = new algCoffee.Heap(anotherArray); heap.buildMaxHeap();
We encourage everybody to contribute with this library. Just try and implement any classic algorithm in CoffeeScript or improve the ones that are already implemented.
You will need to have the following softwares installed on your computer:
Basic Steps to ContributeOn the terminal of your computer clone this repository in the directory where you want it to be:
git clone https://github.com/BrunoRB/algorithms.coffee.git
Install the necessary packages from which the library depends on:
and execute Grunt just to make sure everything is up and running:
From this point on you're good to go and contribute with the library. Just write your .coffee
code in the appropriate directory in ./src
and make sure to write the test code as well. Also, make sure to follow the Coding Style stated in coffeelint.json
and the other default options of CoffeeLint.
Before you send a Pull Request, run grunt
again to be sure that everything is OK.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4