Last 12 weeks · 0 commits
1 of 6 standards met
Repository: fireship-io/sorting-algorithms. Description: A collection of sorting algorithms implemented in JS Stars: 274, Forks: 45. Primary language: JavaScript. Languages: JavaScript (100%). Open PRs: 1, open issues: 1. Last activity: 2y ago. Community health: 25%. Top contributors: codediodeio.
I also sorted (ha) each algorithm based on their general complexity, so that folks who wanna run it can quickly comment out slower algos so that they can test faster ones with better values of N. Interestingly, on my system, Merge sort gets really bad at 1,000,000 elements with its large amount of memory usage, and the custom quick sort performs better than JS sort!
This uses destructuring syntax, to avoid the potential confusion of temporary vars. It also defines a fn that mutates whatever array is passed as input, without returning it. A more functional approach would be to shallow-copy the array, mutate the copy, then return it. Should we do that instead? BTW, can be replaced by (#3 closes it)