Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitf2909c6

Browse files
committed
Update sort.md
修改错字
1 parent0c6abaf commitf2909c6

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)

[8]ページ先頭

©2009-2025 Movatter.jp