Fix bubbleSort

This commit is contained in:
Dmitriy
2021-06-30 12:24:25 +03:00
parent 284962e6a5
commit 0b6e562c61

View File

@ -17,7 +17,7 @@ Sorts an array of numbers, using the bubble sort algorithm.
const bubbleSort = arr => {
let swapped = false;
const a = [...arr];
for (let i = 1; i < a.length - 1; i++) {
for (let i = 1; i < a.length; i++) {
swapped = false;
for (let j = 0; j < a.length - i; j++) {
if (a[j + 1] < a[j]) {