Skip to content

Commit

Permalink
fix bug
Browse files Browse the repository at this point in the history
  • Loading branch information
hunterhug authored Mar 3, 2021
1 parent b62c4a0 commit e0ef2b2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions basic/rescuvie.md
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ func BinarySearch(array []int, target int, l, r int) int {
return mid // 找到了
} else if middleNum > target {
// 中间的数比目标还大,从左边找
return BinarySearch(array, target, 1, mid-1)
return BinarySearch(array, target, 0, mid-1)
} else {
// 中间的数比目标还小,从右边找
return BinarySearch(array, target, mid+1, r)
Expand Down Expand Up @@ -261,4 +261,4 @@ func main() {
}
```

很多计算机问题都可以用递归来简化求解,理论上,所有的递归方式都可以转化为非递归的方式,只不过使用递归,代码的可读性更高。
很多计算机问题都可以用递归来简化求解,理论上,所有的递归方式都可以转化为非递归的方式,只不过使用递归,代码的可读性更高。

0 comments on commit e0ef2b2

Please sign in to comment.