function insertSort(array){
for(i=1, n=array.length; i<n; i++){
key = array[i];
j=i-1;
while(j > -1 && key < array[j]){
array[j+1]=array[j];
j--;
}
array[j+1]=key;
}
return array;
}
Comments (0)
RSS Collapse / ExpandOnly registered and authorized users can leave comments. Login or Register