Bug fixes and improvements (#1133)

* Bug fixes

* Update the figure of the JD link

* Unify the code comments of insertion_sort
This commit is contained in:
Yudong Jin
2024-03-14 20:01:16 +08:00
committed by GitHub
parent eadf4c86d4
commit 01c67781fa
14 changed files with 23 additions and 23 deletions

View File

@ -10,7 +10,7 @@ func insertionSort(nums []int) {
for i := 1; i < len(nums); i++ {
base := nums[i]
j := i - 1
// 内循环:将 base 插入到已排序部分的正确位置
// 内循环:将 base 插入到已排序区间 [0, i-1] 中的正确位置
for j >= 0 && nums[j] > base {
nums[j+1] = nums[j] // 将 nums[j] 向右移动一位
j--