@philskat/js-sort
TypeScript icon, indicating that this package has built-in type declarations

1.2.0 • Public • Published

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]

Package Sidebar

Install

npm i @philskat/js-sort

Weekly Downloads

0

Version

1.2.0

License

MIT

Unpacked Size

10.2 kB

Total Files

11

Last publish

Collaborators

  • philskat