fix: code comments for insertion_sort.go (#1132)

* fix: code comments for insertion_sort.go

* Update insertion_sort.go

---------

Co-authored-by: Prime Xiao <primexiao.dev@gmail.com>
Co-authored-by: Yudong Jin <krahets@163.com>
This commit is contained in:
Prime.X 2024-03-14 20:25:21 +08:00 committed by GitHub
parent 01c67781fa
commit 644eaf99ff
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -6,7 +6,7 @@ package chapter_sorting
/* 插入排序 */ /* 插入排序 */
func insertionSort(nums []int) { func insertionSort(nums []int) {
// 外循环:未排序区间为 [0, i] // 外循环:已排序区间为 [0, i-1]
for i := 1; i < len(nums); i++ { for i := 1; i < len(nums); i++ {
base := nums[i] base := nums[i]
j := i - 1 j := i - 1