mirror of
https://github.com/TheAlgorithms/JavaScript.git
synced 2025-07-06 01:18:23 +08:00
Add function documentation to CycleSort
This commit is contained in:
@ -8,6 +8,12 @@
|
|||||||
* Wikipedia: https://en.wikipedia.org/wiki/Cycle_sort
|
* 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) {
|
function cycleSort (list) {
|
||||||
let writes = 0
|
let writes = 0
|
||||||
for (let cycleStart = 0; cycleStart < list.length; cycleStart++) {
|
for (let cycleStart = 0; cycleStart < list.length; cycleStart++) {
|
||||||
|
Reference in New Issue
Block a user