标签:blog http 使用 java ar strong for 数据 div
背景
//待排序的数组为A,key为需要比较的值 for j = 2->length[A] do key = A[j] i = j - 1 while(i > 0 && A[i] > key) do A[i+1] = A[i] i = i - 1 A[i+1] = key
var arr = [3,9,5,1,7,3]; //可以生成一些比较复杂的数据 var key,j; console.time(‘time‘); for(var i = 1; i < arr.length; i++) { key = arr[i]; j = i - 1; while(j >= 0 && arr[j] > key) { arr[j+1] = arr[j]; j--; } arr[j+1] = key; } console.timeEnd(‘time‘); console.log(arr);
标签:blog http 使用 java ar strong for 数据 div
原文地址:http://www.cnblogs.com/xiaoheimiaoer/p/3969970.html