An NPM package for commonly used algorithms.
To install,
npm install nodorithm
- Binary Search
- Interpolation Search
- Jump Search
- Linear Search
- Bubble Sort
- Comb Sort
- Counting Sort
- Heap Sort
- Insertion Sort
- Merge Sort
- Quick Sort
- Selection Sort
- Shell Sort
- Capitalize First Letter
To use the package,
const nodorithm = require('nodorithm');
Each algorithm takes 2 arguments.
var result = (nodorithm.search.binarySearch(array=[1,2,3,4], key=3));
console.log(result);
var result = (nodorithm.search.interpolationSearch(array=[1,2,3,4], key=3));
console.log(result);
var result = (nodorithm.search.jumpSearch(array=[1,2,3,4], key=3));
console.log(result);
var result = (nodorithm.search.linearSearch(array=[1,2,3,4], key=3));
console.log(result);
Each algorithm takes 1 argument.
var result = (nodorithm.sort.bubbleSort(array=[4,2,3,1]));
console.log(result);
var result = (nodorithm.sort.combSort(array=[4,2,3,1]));
console.log(result);
var result = (nodorithm.sort.countingSort(array=[4,2,3,1]));
console.log(result);
var result = (nodorithm.sort.heapSort(array=[4,2,3,1]));
console.log(result);
var result = (nodorithm.sort.insertionSort(array=[4,2,3,1]));
console.log(result);
var result = (nodorithm.sort.mergeSort(array=[4,2,3,1]));
console.log(result);
var result = (nodorithm.sort.quickSort(array=[4,2,3,1]));
console.log(result);
var result = (nodorithm.sort.selectionSort(array=[4,2,3,1]));
console.log(result);
var result = (nodorithm.sort.shellSort(array=[4,2,3,1]));
console.log(result);
Each algorithm takes 1 argument.
var result = (nodorithm.string.capitalizeFirstLetter(string="abcd efgh"));
console.log(result);