1
0
mirror of https://github.com/142vip/408CSFamily.git synced 2026-04-13 18:00:58 +08:00

feat: 修改代码

This commit is contained in:
喜欢芝士的妹妹
2023-08-30 22:12:32 +08:00
parent 1f3e23fa74
commit 6d81d1706a
17 changed files with 27 additions and 421 deletions

View File

@@ -13,7 +13,7 @@ function binaryInsertSort(arr, len) {
while (lowIndex <= highIndex) {
// 注意:取整,javascript这里取整会出现空指针
const mid = parseInt((lowIndex + highIndex) / 2)
const mid = Math.ceil((lowIndex + highIndex) / 2)
if (arr[mid] <= temp) {
// 右侧
@@ -24,7 +24,6 @@ function binaryInsertSort(arr, len) {
}
}
// 元素后移
for (let j = i - 1; j > highIndex; --j) {
arr[j + 1] = arr[j]
}