Skip to content

Commit 5ea7b09

Browse files
committed
fix index
1 parent 0a8d0cf commit 5ea7b09

4 files changed

Lines changed: 7 additions & 3 deletions

File tree

basic_algorithm/binary_search.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ func searchMatrix(matrix [][]int, target int) bool {
220220
```go
221221
func firstBadVersion(n int) int {
222222
// 思路:二分搜索
223-
start := 0
223+
start := 1
224224
end := n
225225
for start+1 < end {
226226
mid := start + (end - start)/2

basic_algorithm/sort.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ func quickSort(nums []int, start, end int) {
1616
if start < end {
1717
// 分治法:divide
1818
pivot := partition(nums, start, end)
19-
quickSort(nums, 0, pivot-1)
19+
20+
quickSort(nums, start, pivot-1)
2021
quickSort(nums, pivot+1, end)
2122
}
2223
}

data_structure/binary_tree.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ func quickSort(nums []int, start, end int) {
322322
if start < end {
323323
// 分治法:divide
324324
pivot := partition(nums, start, end)
325-
quickSort(nums, 0, pivot-1)
325+
quickSort(nums, start, pivot-1)
326326
quickSort(nums, pivot+1, end)
327327
}
328328
}

src/go.mod

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module github.com/greyireland/algorithm-pattern
2+
3+
go 1.16

0 commit comments

Comments
 (0)