mirror of
https://github.com/TheAlgorithms/JavaScript.git
synced 2025-07-05 00:01:37 +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,
|
||||
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
|
||||
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.
|
||||
*/
|
||||
/**
|
||||
* Cycle sort is an in-place, unstable sorting algorithm,
|
||||
* 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
|
||||
* 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.
|
||||
*/
|
||||
|
||||
function cycleSort (list) {
|
||||
let writes = 0
|
||||
|
Reference in New Issue
Block a user