JavaScript
0 / 1
Code
const arr = [...input.array];

for (let i = 0; i < arr.length - 1; i++) {
  for (let j = 0; j < arr.length - i - 1; j++) {
    if (arr[j] > arr[j + 1]) {
      [arr[j], arr[j + 1]] = [arr[j + 1], arr[j]];
    }
  }
}

return arr;
Personal workspace
View all →
Visualization
Paused
Run the code to see your first algorithm state.

Variables

Run the code to see variables here.

Call stack

Run the code to see the call stack here.

arrayarray