mirror of
https://github.com/TheAlgorithms/JavaScript.git
synced 2025-07-06 01:18:23 +08:00
Improved main Description comment | Cycle Sort
This commit is contained in:
@ -1,10 +1,10 @@
|
|||||||
/*
|
/**
|
||||||
Wikipedia says: Cycle sort is an in-place, unstable sorting algorithm,
|
* Cycle sort is an in-place, unstable sorting algorithm,
|
||||||
a comparison sort that is theoretically optimal in terms of the total
|
* a comparison sort that is theoretically optimal in terms of the total
|
||||||
number of writes to the original array, unlike any other in-place sorting
|
* number of writes to the original array, unlike any other in-place sorting
|
||||||
algorithm. It is based on the idea that the permutation to be sorted can
|
* algorithm. It is based on the idea that the permutation to be sorted can
|
||||||
be factored into cycles, which can individually be rotated to give a sorted result.
|
* be factored into cycles, which can individually be rotated to give a sorted result.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function cycleSort (list) {
|
function cycleSort (list) {
|
||||||
let writes = 0
|
let writes = 0
|
||||||
|
Reference in New Issue
Block a user