Add function documentation to CycleSort

This commit is contained in:
Charlie Moore
2021-10-04 18:49:54 -04:00
parent f4814ba143
commit 720b7b054b

View File

@ -8,6 +8,12 @@
* Wikipedia: https://en.wikipedia.org/wiki/Cycle_sort
*/
/**
* cycleSort takes an input array of numbers and returns the array sorted in increasing order.
*
* @param {number[]} list An array of numbers to be sorted.
* @return {number[]} An array of numbers sorted in increasing order.
*/
function cycleSort (list) {
let writes = 0
for (let cycleStart = 0; cycleStart < list.length; cycleStart++) {