// 最原始的方法
function bubble(arr) {
for (var i = 0; i < arr.length; i += 1) {
for (var j = 0; j < arr.length; j += 1) {
if (arr[j] > arr[j + 1]) {
var temp = arr[j];
arr[j] = arr[j + 1];
arr[j + 1] = temp;
}
}
}
}
function bubble(arr) {
for (var i = 0; i < arr.length; i += 1) {
for (var j = 0; j < arr.length - 1; j += 1) {
if (arr[j] > arr[j + 1]) {
var temp = arr[j];
arr[j] = arr[j + 1];
arr[j + 1] = temp;
}
}
}
}
function bubble(arr) {
for (var i = 0; i < arr.length; i += 1) {
for (var j = 0; j < arr.length - 1 - i; j += 1) {
if (arr[j] > arr[j + 1]) {
var temp = arr[j];
arr[j] = arr[j + 1];
arr[j + 1] = temp;
}
}
}
}