This package lets you sort your array in ascending or descending order with many different algorithms.
npm install js-sortifyjs-sortify LibraryThis npm package includes various sorting algorithms. Users can sort an array by providing an array and a sorting order (ascending - "asc" or descending - "desc").
``bash`
npm install js-sortify
# or
yarn add js-sortify
1. Importing the Library:
`javascript`
const sortify = require("js-sortify");
// or
import { quickSort, isSorted } from "js-sortify";
2. Example Usage:
`javascript
const sortedArray = sortify.quickSort(array, "asc");
// or
const sortedArray = quickSort(array, "asc");
console.log(sortedArray);
`
All functions below returns the sorted array
1. bubbleSort(array, sortOrder = 'asc')insertionSort(array, sortOrder = 'asc')
2. selectionSort(array, sortOrder = 'asc')
3. mergeSort(array, sortOrder = 'asc')
4. quickSort(array, sortOrder = 'asc')
5. heapSort(array, sortOrder = 'asc')
6. radixSort(array, sortOrder = 'asc')
7. shellSort(array, sortOrder = 'asc')
8. cocktailSort(array, sortOrder = 'asc')
9. bogoSort(array, sortOrder = 'asc')
10.
1. shuffle(array): Used to shuffle an array.isSorted(array, sortOrder)
2. : Checks if an array is sorted. (Returns True or False)
- array (Array)
- sortOrder (String) - 'asc' or 'desc' ('asc'` by default)
Feel free to reach out for any questions or suggestions.
- Email: hello@sezergumus.dev