1.0.5 • Published 6 years ago

sorting-javascript v1.0.5

Weekly downloads
3
License
MIT
Repository
github
Last release
6 years ago

sorting-js

npm version MIT license Build Status Coverage Status dependencies Status NPM

Sorting algorithms implemented in JS

How to Install

$ npm install sorting-javascript

Getting Started

ES6 - Use named imports

  import { insertionSort } from 'sorting-javascript'
  insertionSort([7, 2, 5]) // Output - [2, 5, 7]

Node.JS require

  var sort = require('sorting-javascript')
  sort.insertionSort([7, 2, 5]) // Output - [2, 5, 7]

There is an extra utility function called ArrayTestBed which generates random numbers to test the sorting algorithms.

  import { ArrayTestBed } from 'sorting-javascript'
  const test = new ArrayTestBed(1000);
  test.setData() // test variable will have 1000 randomly generated numbers between 0-1000

By default, it will contain unique elements. If you pass random = false to the setData function, then the result will contain duplicates. eg:

  test.setData(false) // [5, 6, 6, 8, 3, 2, 2]
  test.setData() // [1, 7, 6, 8, 3, 2, 5]

List of sorting algorithms

  • Bubble sort
  • Counting sort
  • Insertion sort
  • merge sort
  • quick sort
  • selection sort

For Geeks :P

How to Test

Run one, or a combination of the following commands to lint and test your code:

$ npm run lint          # Lint the source code with ESLint
$ npm test              # Run unit tests with Mocha
$ npm run test:watch    # Run unit tests with Mocha, and watch files for changes
$ npm run test:cover    # Run unit tests with code coverage by Istanbul

To launch the documentation site, run:

$ npm install -g easystatic
$ npm start

License

MIT © 2016 Neelesh Roy

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago

0.0.5

6 years ago

0.0.3

6 years ago

0.0.2

6 years ago

0.0.1

6 years ago

0.0.0

6 years ago