Fix standardjs style errors

This commit is contained in:
Charlie Moore
2021-10-04 18:54:59 -04:00
parent 519f557899
commit 8e5743f8cb

View File

@ -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