Bubble Sory

Run Settings
LanguageJavaScript
Language Version
Run Command
//Bubble Sort //Inserting Sort //Selection Sort //Merge Sort //Quick Sort const letters = ['a','d','z','e','r','b']; const numbers = [99, 44, 6, 2, 1, 5, 63, 87, 283, 4, 0]; function bubbleSort(array) { let len = array.length; for(let i = 0; i < len; i++) { for(let j= 0; j< len; j++) { if(array[j]> array[j+1]) { const temp = array[j]; array[j]= array[j+1]; array[j+1] = temp } } } return array; } bubbleSort(numbers); console.log(numbers);
Editor Settings
Theme
Key bindings
Full width
Lines