Skip to content

Commit b716359

Browse files
committed
Merge branch 'master' of github.com:krahets/hello-algo
2 parents 5f0ae84 + 6064e3b commit b716359

File tree

3 files changed

+3
-1
lines changed

3 files changed

+3
-1
lines changed

codes/go/chapter_heap/my_heap.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ func (h *maxHeap) poll() any {
9898
// 判空处理
9999
if h.isEmpty() {
100100
fmt.Println("error")
101+
return nil
101102
}
102103
// 交换根结点与最右叶结点(即交换首元素与尾元素)
103104
h.swap(0, h.size()-1)

docs/chapter_heap/heap.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -606,6 +606,7 @@ comments: true
606606
// 判空处理
607607
if h.isEmpty() {
608608
fmt.Println("error")
609+
return nil
609610
}
610611
// 交换根结点与最右叶结点(即交换首元素与尾元素)
611612
h.swap(0, h.size()-1)

docs/chapter_sorting/quick_sort.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -490,7 +490,7 @@ comments: true
490490
func medianThree(nums []int, left, mid, right int) int {
491491
if (nums[left] < nums[mid]) != (nums[left] < nums[right]) {
492492
return left
493-
} else if (nums[mid] < nums[left]) != (nums[mid] > nums[right]) {
493+
} else if (nums[mid] > nums[left]) != (nums[mid] > nums[right]) {
494494
return mid
495495
}
496496
return right

0 commit comments

Comments
 (0)