//直接插入排序
function insert_sort(arr){
var key;
var len = arr.length;
for(var i = 1; i < len; i++){
key = arr[i];
var j = i-1;
while((j >= 0) && (arr[j] > key)){
arr[j+1] = arr[j];
j--;
}
arr[j] = key;
}
alert(arr);
}
//直接插入排序
function insert_sort(arr){
var key;
var len = arr.length;
for(var i = 1; i < len; i++){
key = arr[i];
var j = i-1;
while((j >= 0) && (arr[j] > key)){
arr[j+1] = arr[j];
j--;
}
arr[j] = key;
}
alert(arr);
}