public void insertSort(int arr[]){
for (int i = 1; i < arr.length; i++) {
int curValue = arr[i];
int curPos = i-1;
while (curPos>=0&&curValue<arr[curPos]){
arr[curPos+1] = arr[curPos];
curPos--;
}
arr[curPos+1] = curValue;
}
}
2.1插入算法
最新推荐文章于 2023-12-17 13:12:15 发布