1.2.1 • Published 6 years ago

nodorithm v1.2.1

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

Nodorithm

An NPM package for commonly used algorithms.

GitHub repository

Get started

To install,

npm install nodorithm

Algorithms

Searching
  • Binary Search
  • Interpolation Search
  • Jump Search
  • Linear Search
Sorting
  • Bubble Sort
  • Comb Sort
  • Counting Sort
  • Heap Sort
  • Insertion Sort
  • Merge Sort
  • Quick Sort
  • Selection Sort
  • Shell Sort
String
  • Capitalize First Letter

Usage

To use the package,

const nodorithm = require('nodorithm');
Searching

Each algorithm takes 2 arguments.

Binary Search
var result = (nodorithm.search.binarySearch(array=[1,2,3,4], key=3));
console.log(result);
Interpolation Search
var result = (nodorithm.search.interpolationSearch(array=[1,2,3,4], key=3));
console.log(result);
Jump Search
var result = (nodorithm.search.jumpSearch(array=[1,2,3,4], key=3));
console.log(result);
Linear Search
var result = (nodorithm.search.linearSearch(array=[1,2,3,4], key=3));
console.log(result);
Sorting

Each algorithm takes 1 argument.

Bubble Sort
var result = (nodorithm.sort.bubbleSort(array=[4,2,3,1]));
console.log(result);
Comb Sort
var result = (nodorithm.sort.combSort(array=[4,2,3,1]));
console.log(result);
Counting Sort
var result = (nodorithm.sort.countingSort(array=[4,2,3,1]));
console.log(result);
Heap Sort
var result = (nodorithm.sort.heapSort(array=[4,2,3,1]));
console.log(result);
Insertion Sort
var result = (nodorithm.sort.insertionSort(array=[4,2,3,1]));
console.log(result);
Merge Sort
var result = (nodorithm.sort.mergeSort(array=[4,2,3,1]));
console.log(result);
Quick Sort
var result = (nodorithm.sort.quickSort(array=[4,2,3,1]));
console.log(result);
Selection Sort
var result = (nodorithm.sort.selectionSort(array=[4,2,3,1]));
console.log(result);
Shell Sort
var result = (nodorithm.sort.shellSort(array=[4,2,3,1]));
console.log(result);
String

Each algorithm takes 1 argument.

Capitalize First Letter
var result = (nodorithm.string.capitalizeFirstLetter(string="abcd efgh"));
console.log(result);
1.2.1

6 years ago

1.1.2

6 years ago

1.1.1

6 years ago

1.1.0

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