mirror of
https://github.com/TheAlgorithms/JavaScript.git
synced 2025-07-07 02:05:08 +08:00
Fix standardjs style errors
This commit is contained in:
@ -15,7 +15,6 @@
|
|||||||
* @return {number[]} An array of numbers sorted in increasing order.
|
* @return {number[]} An array of numbers sorted in increasing order.
|
||||||
*/
|
*/
|
||||||
function cycleSort (list) {
|
function cycleSort (list) {
|
||||||
let writes = 0
|
|
||||||
for (let cycleStart = 0; cycleStart < list.length; cycleStart++) {
|
for (let cycleStart = 0; cycleStart < list.length; cycleStart++) {
|
||||||
let value = list[cycleStart]
|
let value = list[cycleStart]
|
||||||
let position = cycleStart
|
let position = cycleStart
|
||||||
@ -30,7 +29,6 @@ function cycleSort (list) {
|
|||||||
if (position === cycleStart) {
|
if (position === cycleStart) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
while (value === list[position]) {
|
while (value === list[position]) {
|
||||||
position++
|
position++
|
||||||
}
|
}
|
||||||
@ -38,7 +36,6 @@ function cycleSort (list) {
|
|||||||
const oldValue = list[position]
|
const oldValue = list[position]
|
||||||
list[position] = value
|
list[position] = value
|
||||||
value = oldValue
|
value = oldValue
|
||||||
writes++
|
|
||||||
|
|
||||||
// rotate the rest
|
// rotate the rest
|
||||||
while (position !== cycleStart) {
|
while (position !== cycleStart) {
|
||||||
@ -54,7 +51,6 @@ function cycleSort (list) {
|
|||||||
const oldValueCycle = list[position]
|
const oldValueCycle = list[position]
|
||||||
list[position] = value
|
list[position] = value
|
||||||
value = oldValueCycle
|
value = oldValueCycle
|
||||||
writes++
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return list
|
return list
|
||||||
|
Reference in New Issue
Block a user