Skip to content

Commit f2909c6

Browse files
committed
Update sort.md
修改错字
1 parent 0c6abaf commit f2909c6

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

basic_algorithm/sort.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,15 +121,15 @@ func sink(a []int, i int, length int) {
121121
for {
122122
// 左节点索引(从0开始,所以左节点为i*2+1)
123123
l := i*2 + 1
124-
// 有节点索引
124+
// 右节点索引
125125
r := i*2 + 2
126126
// idx保存根、左、右三者之间较大值的索引
127127
idx := i
128128
// 存在左节点,左节点值较大,则取左节点
129129
if l < length && a[l] > a[idx] {
130130
idx = l
131131
}
132-
// 存在有节点,且值较大,取右节点
132+
// 存在右节点,且值较大,取右节点
133133
if r < length && a[r] > a[idx] {
134134
idx = r
135135
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy