SHARE
TWEET

Untitled

a guest Sep 14th, 2017 76 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function bubbleSort(arr) {
  2.       const len = arr.length;
  3.       for (let i = 0; i < len ; i++) {
  4.         for(let j = 0 ; j < len - i - 1; j++){
  5.         if (arr[j] > arr[j + 1]) {
  6.           const temp = arr[j];
  7.           arr[j] = arr[j+1];
  8.           arr[j + 1] = temp;
  9.         }
  10.        }
  11.       }
  12.       return arr;
  13.     }
RAW Paste Data
Top