1.0.4 • Published 6 years ago

sorting-algos v1.0.4

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

sorting-algos

implementation of various sorting algorithms in javascript

Build Status

Usage

Example

  var {bubbleSort} = require('sorting-algos')
  var {selectionSort} = require('sorting-algos')
  var {insertionSort} = require('sorting-algos')
  var {heapSort} = require('sorting-algos')
  var {mergeSort} = require('sorting-algos')
  var {quickSort} = require('sorting-algos')

  var items = [35, 13, 44, 53, 1, 34, 51, 15, 88, 42]

  console.log(bubbleSort(items))
  console.log(selectionSort(items))
  console.log(insertionSort(items))
  console.log(heapSort(items))
  console.log(mergeSort(items))
  console.log(quickSort(items))

API

var {sorter} = require('sorting-algos')

loads sorting algorithm where sorter can be bubbleSort, selectionSort, insertionSort, heapSort, mergeSort or quickSort

sorter(items)

sorts items in ascending order and returns it

License

MIT

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