1.0.8 • Published 6 years ago

algorithm_practice v1.0.8

Weekly downloads
4
License
ISC
Repository
github
Last release
6 years ago

Project name:

algorithm_practice

Introduce

This is an algorithm practice project.

It's now only has three sorting algorithm : merge sort, quick sort and insertion sort.

Dec 8. update: new algorithm: quickSelect

Dec 9. update: new algorithm: medianOf2SortedArray

Dec 10. update: new algorithm: counting sort

The algorithm only support for numbers.

Install

npm install algorithm_practice

How to use it

init
var algorithm = require('algorithm_practice')
let alg = new algorithm()
mergeSort
let result = alg.mergeSort(data,left,right)
quickSort
alg.quickSort(data) // data will be sorted because of called by reference
insertionSort
let result = alg.insertionSort(data)
quickSelect
let result = alg.quickSelect(data,k) // k means select the kth smallest from data
medianOf2SortedArray
let result = alg.medianOf2SortedArray(data1,data2) //note that the length of two data must be the same
countingSort
let result = alg.countingSort(data) // data must be positive numbers
1.0.8

6 years ago

1.0.7

6 years ago

1.0.6

6 years ago

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