1.2.0 • Published 3 years ago

@philskat/js-sort v1.2.0

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

Node.js CI npm bundle size npm Gitpod ready-to-code Docs

js-sort

This npm package contains a few sorting algorithms to sort arrays of numbers.

Quick Sort

const { quickSort } = require('@philskat/js-sort');

const arr = quickSort([3, 1, 2]); // Output: [1, 2, 3]

Bubble Sort

const { bubbleSort } = require('@philskat/js-sort');

const arr = bubbleSort([3, 1, 2]); // Output: [1, 2, 3]

Insertion Sort

const { insertionSort } = require('@philskat/js-sort');

const arr = insertionSort([3, 1, 2]); // Output: [1, 2, 3]

Insert Sorted

Add a new entry to an array and sort that entry in the array.

const { insertSorted } = require('@philskat/js-sort');
const arr = [1, 2, 4, 5];

arr = insertSorted(arr, 3); // Output: [1, 2, 3, 4, 5]