quick-srt
v1.0.1
Published
Quick Sort Algorithm Implementation
Downloads
8
Maintainers
Readme
Overview
Quicksort is an efficient sorting algorithm, serving as a systematic method for placing the elements of an array in order. Developed by Tony Hoare in 1959, and published in 1961, it is still a commonly used algorithm for sorting. When implemented well, it can be about two or three times faster than its main competitors, merge sort and heapsort.
Install
npm install quick-srt
Usage
const quickSort = require('quick-srt');
let numsArr = [46, 24, 33, 10, 2, 81, 50];
console.log(quickSort(numsArr));
// => [ 2, 10, 24, 33, 46, 50, 81 ]
let lettersArr = ['d', 'h', 'z', 'a', 'r', 'b', 'i'];
console.log(quickSort(lettersArr));
// => [ 'a', 'b', 'd', 'h', 'i', 'r', 'z' ]
let wordsArr = ['happy', 'auto', 'energy', 'zoo', 'trigonometry', 'dog', 'foo'];
console.log(quickSort(wordsArr));
// => [ 'auto', 'dog', 'energy', 'foo', 'happy', 'trigonometry', 'zoo' ]
API
quickSort(array)
Return a sorted array using quick sort algorithm
Related
- quick-srt-cli: CLI for this module
- bubble-srt: Bubble Sort Algorithm Implementation
- merge-srt: Merge Sort Algorithm Implementation
Team
|| | :-: | | Carlos Abraham |
License
MIT License © Carlos Abraham