All Projects → sumtype → common-algorithms-js

sumtype / common-algorithms-js

Licence: MIT License
Common algorithms implemented in JavaScript.

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to common-algorithms-js

Algorithms-Java
A collection of common algorithms and data structures implemented in Java.
Stars: ✭ 141 (+314.71%)
Mutual labels:  computer-science, graph-algorithms, sorting-algorithms
Javascript Datastructures Algorithms
📚 collection of JavaScript and TypeScript data structures and algorithms for education purposes. Source code bundle of JavaScript algorithms and data structures book
Stars: ✭ 3,221 (+9373.53%)
Mutual labels:  graph-algorithms, sorting-algorithms, javascript-algorithms
Thealgorithms
Algorithms repository.
Stars: ✭ 122 (+258.82%)
Mutual labels:  computer-science, sorting-algorithms
Classiccomputerscienceproblemsinswift
Source Code for the Book Classic Computer Science Problems in Swift
Stars: ✭ 142 (+317.65%)
Mutual labels:  computer-science, graph-algorithms
Javascript Algorithms
📝 Algorithms and data structures implemented in JavaScript with explanations and links to further readings
Stars: ✭ 133,406 (+392270.59%)
Mutual labels:  computer-science, javascript-algorithms
Dsa Geeksclasses
DSA-Self Paced With Doubt Assistance Course Solutions in Python (Python 3)
Stars: ✭ 137 (+302.94%)
Mutual labels:  graph-algorithms, sorting-algorithms
Algorithms
A collection of common algorithms and data structures implemented in java, c++, and python.
Stars: ✭ 142 (+317.65%)
Mutual labels:  graph-algorithms, sorting-algorithms
Computer Science In Javascript
Computer science reimplemented in JavaScript
Stars: ✭ 2,590 (+7517.65%)
Mutual labels:  computer-science, sorting-algorithms
Learn some algorithm and data structure
从零开始回顾一下最简单最基础的算法与数据结构
Stars: ✭ 38 (+11.76%)
Mutual labels:  graph-algorithms, sorting-algorithms
interview-cookbook
A playground for learning DataStructures, Algorithms, and Object-Oriented Concepts.
Stars: ✭ 25 (-26.47%)
Mutual labels:  sorting-algorithms, javascript-algorithms
Grafatko
An app for creating and visualizing graphs and graph-related algorithms.
Stars: ✭ 22 (-35.29%)
Mutual labels:  computer-science, graph-algorithms
Data structure and algorithms library
A collection of classical algorithms and data-structures implementation in C++ for coding interview and competitive programming
Stars: ✭ 133 (+291.18%)
Mutual labels:  graph-algorithms, sorting-algorithms
Data Structures With Go
Data Structures with Go Language
Stars: ✭ 121 (+255.88%)
Mutual labels:  graph-algorithms, sorting-algorithms
Dsa.js Data Structures Algorithms Javascript
🥞Data Structures and Algorithms explained and implemented in JavaScript + eBook
Stars: ✭ 6,251 (+18285.29%)
Mutual labels:  computer-science, javascript-algorithms
Algorithm Notes
Comprehensive algorithms solution to help engineers prepare their interviews and future study
Stars: ✭ 44 (+29.41%)
Mutual labels:  graph-algorithms, sorting-algorithms
Pretty Algorithms
🌊 Pretty, common and useful algorithms with modern JS and beautiful tests
Stars: ✭ 2,163 (+6261.76%)
Mutual labels:  computer-science, sorting-algorithms
js-algorithms
Computer science
Stars: ✭ 64 (+88.24%)
Mutual labels:  computer-science, sorting-algorithms
C Sharp Algorithms
📚 📈 Plug-and-play class-library project of standard Data Structures and Algorithms in C#
Stars: ✭ 4,684 (+13676.47%)
Mutual labels:  graph-algorithms, sorting-algorithms
Advanced Algorithms
100+ algorithms & data structures generically implemented in C#.
Stars: ✭ 752 (+2111.76%)
Mutual labels:  graph-algorithms, sorting-algorithms
algorithms
A open source repository of different kinds of algorithms in c. Newbies are encouraged to contribute! Note: I made this code when i didn't have as much experience in programming
Stars: ✭ 33 (-2.94%)
Mutual labels:  computer-science, sorting-algorithms

Common Algorithms in JavaScript

Build Status Coverage Status Known Vulnerabilities JavaScript Style Guide npm

Common algorithms implemented in JavaScript with Mocha/Chai testing. Uses Babel and UMD to transpile algorithm modules from ES6+ to ES5. Test coverage reports are provided by nyc and piped to Coveralls. Coveralls reports coverage for ES6+ algorithms (although both ES6+ and transpiled ES5 algorithms are tested by Travis-CI). All JavaScript code follows JavaScript Standard Style guidelines. README translations are provided in the locales directory and translated with Google Translate. Currently Spanish, Hebrew, and Chinese are available. Contributions are welcome! Follow the guidelines.

Array

Geometry

Graph

Math

String

Usage

To install the algorithms for use in your project run:

yarn add common-algorithms-js

or if you don't have Yarn installed, run:

npm i common-algorithms-js

Once you've downloaded the library, you can start using it in your project like this:

Using require()

var algorithms = require('common-algorithms-js/es5').default

or if you only want a specific algorithm (the Bezier Curve algorithm for example):

var bezierCurve = require('common-algorithms-js/es5').bezierCurve

or if you only want a specific category of algorithms (string algorithms for example):

var stringAlgorithms = require('common-algorithms-js/es5').string

Using ES6 Import/Export

import * as algorithms from 'common-algorithms-js'

or if you only want a specific algorithm (the Fibonacci Number algorithm for example):

import { fibonacciNumber } from 'common-algorithms-js'

or if you only want a specific category of algorithms (math algorithms for example):

import { math } from 'common-algorithms-js'

The default export returns an object that looks something like this:

{
  array: {
    binarySearch: function...,
    bubbleSort: function...,
    ...
  },
  geometry: {
    bezierCurve: function...,
    ...
  },
  graph: {
    breadthFirstSearch: function...,
    ...
  },
  math: {
    fibonacciNumber: function...,
    ...
  },
  string: {
    areAnagrams: function...,
    ...
  },
}

it contains all the algorithms available in the library.

Testing

To run the tests yourself you'll need to download the project and install its node module dependencies via yarn or npm. So, if you haven't already installed Node.js and npm or yarn for use on your command line hop over to the NVM repository to get setup with the Node.js version you'd like to work with. Once you have Node.js and npm installed, clone the project onto your computer using the following command in your terminal/command prompt/console:

git clone https://github.com/sumtype/common-algorithms-js.git

(Just in case you haven't already installed Git, do so by following the installation instructions here, then enter the previous command again once it's installed.) Once you've downloaded the project use the following command to navigate to the project's root directory:

cd common-algorithms-js

Next, install the project's node module dependencies from npm or yarn. Do so by entering this command:

npm i

or this command:

yarn

Once all the dependencies are installed you'll be ready to run the tests. Enter the following command to run them:

npm test

or

yarn test

When running npm test or yarn test all the algorithms, tests, and "./es5.js" file are transpiled based on their corresponding ES6+ files. This way when running your tests not only are your ES6+ algorithms tested in an ES6+ context, but your transpiled ES5 algorithms are tested in transpiled ES5 test contexts. Since modules in tests are loaded via "./es.js" or the transpiled "./es5.js" file the export files themselves are tested too. In addition, standard is run to ensure all ES6+/ES5 code is style compliant and the test breaks if there are issues.

This repository uses Travis-CI for deployment testing on Node.js versions 10.15.x and 11.8.x. Test coverage is reported by Coveralls. Test reports are generated by nyc.

Transpiling ES5 Algorithms

You can also transpile the ES5 versions of tests and algorithms manually. To do so, run:

npm run transpile-es5

or

yarn transpile-es5

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].