ezalgo
v1.0.4
Published
A JavaScript library for various algorithms
Downloads
8
Readme
Link to the Webpage Documentation
https://yanguangchen.github.io/EzAlgo.js/
/$$$$$$$$ /$$$$$$$$ /$$$$$$ /$$ /$$$$$$ /$$$$$$
| $$_____/|_____ $$ /$$__ $$| $$ /$$__ $$ /$$___ $$
| $$ /$$/ | $$ \\ $$| $$ | $$ \\__/|$$ | $$
| $$$$$ /$$/ | $$$$$$$$| $$ | $$ /$$$$| $$ | $$
| $$__/ /$$/ | $$__ $$| $$ | $$|_ $$| $$ | $$
| $$ /$$/ | $$ | $$| $$ | $$ \\ $$| $$ | $$
| $$$$$$$$ /$$$$$$$$ | $$ | $$| $$$$$$$$| $$$$$$/ | $$$$$$/
|________/|________/ |__/ |__/|________/ \\______/ \\______/
Sorting Algorithms
Below are the sorting algorithms available, along with their descriptions and examples of how to use them.
Usage Example:
Install directly using NPM
npm install ezalgo
quicksort
const sortedArray = quickSort([3, 1, 4, 1, 5, 9, 2, 6]);
console.log(sortedArray);
mergesort
const sortedArray = mergeSort([3, 1, 4, 1, 5, 9, 2, 6]);
console.log(sortedArray);
heapsort
const sortedArray = heapSort([3, 1, 4, 1, 5, 9, 2, 6]);
console.log(sortedArray);
selectionsort
const sortedArray = selectionSort([3, 1, 4, 1, 5, 9, 2, 6]);
console.log(sortedArray);
bubblesort
const sortedArray = bubbleSort([3, 1, 4, 1, 5, 9, 2, 6]);
console.log(sortedArray);
binary Search
const index = binarySearch([1, 2, 3, 4, 5], 3);
console.log(index); // Outputs: 2
Linear Search
const index = linearSearch([1, 2, 3, 4, 5], 4);
console.log(index); // Outputs: 3