Skip to content

Commit ac488fe

Browse files
committed
Cocktail Shaker Sort | Code wasn't returning sorted Items. Changed that.
1 parent 3a7da23 commit ac488fe

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

Sorts/CocktailShakerSort.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
*/
1111
function cocktailShakerSort (items) {
1212
for (let i = items.length - 1; i > 0; i--) {
13-
let swapped = false
1413
let j
1514

1615
// Backwards
@@ -28,10 +27,9 @@ function cocktailShakerSort (items) {
2827
swapped = true
2928
}
3029
}
31-
if (!swapped) {
32-
return
33-
}
3430
}
31+
32+
return items
3533
}
3634

3735
/**

0 commit comments

Comments
 (0)