mirror of
https://github.com/TheAlgorithms/JavaScript.git
synced 2025-07-06 09:28:26 +08:00
Standard fixes | Cycle Sort
This commit is contained in:
@ -4,7 +4,7 @@
|
|||||||
* 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.
|
||||||
*
|
*
|
||||||
* Wikipedia: https://en.wikipedia.org/wiki/Cycle_sort
|
* Wikipedia: https://en.wikipedia.org/wiki/Cycle_sort
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -63,5 +63,5 @@ console.log('\n- Before Sort | Implementation of Cycle Sort -')
|
|||||||
console.log(array)
|
console.log(array)
|
||||||
// After Sort
|
// After Sort
|
||||||
console.log('- After Sort | Implementation of Cycle Sort -')
|
console.log('- After Sort | Implementation of Cycle Sort -')
|
||||||
console.log(countingSort(array))
|
console.log(cycleSort(array))
|
||||||
console.log('\n')
|
console.log('\n')
|
||||||
|
Reference in New Issue
Block a user