0.0.7 • Published 4 years ago

sort-ts v0.0.7

Weekly downloads
3
License
GPL-3.0-or-later
Repository
github
Last release
4 years ago

sort-ts

build

Sorting algorithms for Typescript. All of the implemented algorithms are at the moment not-in-place ones, meaning they create and return a new array instead of mutating the original one.

Install

npm install sort-ts

Use

import {
  binaryTreeSort,
  bubbleSort,
  insertionSort,
  mergeSort,
  quickSort,
  selectionSort,
  shellSort
} from 'sort-ts';

// Compare function for ascending order
function compare(a: number, b: number): number {
  return a - b;
}

const orderedArray = bubbleSort([-1, 1, -100, 1000, 23, 34, 10000, 0], compare);
// Same for other algorithms

Contribute

Some algorithms could be added to the library. Feel free to add new ones and create a pull request!

0.0.7

4 years ago

0.0.6

4 years ago

0.0.5

4 years ago

0.0.4

4 years ago

0.0.3

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago