Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

typo: As much as possible #1591

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions 算法思维系列/二分查找详解.md
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ int floor(int[] nums, int target) {
}
```

最后,我的建议是,如果你必须手写二分代码,那么你一定要了解清楚代码的种种行为,本文总结的框架就是在帮你理清这里面的细节。如果非必要,不要自己手写,尽肯能用编程语言提供的标准库函数,可以节约时间,而且标准库函数的行为在文档里都有明确的说明,不容易出错。
最后,我的建议是,如果你必须手写二分代码,那么你一定要了解清楚代码的种种行为,本文总结的框架就是在帮你理清这里面的细节。如果非必要,不要自己手写,尽可能用编程语言提供的标准库函数,可以节约时间,而且标准库函数的行为在文档里都有明确的说明,不容易出错。

:::

Expand Down Expand Up @@ -409,7 +409,7 @@ if (nums[mid] == target) {

这个结论不用死记,你要是拿不准,简单举个例子就能得到这个结论了。比如 `nums = [2,3,5,7], target = 4`,`right_bound` 函数返回值是 1,因为元素 3 是小于 4 的最大元素。

与前面的建议相同,考虑到二分搜索代码细节的复杂性,如果非必要,不要自己手写,尽肯能用编程语言提供的标准库函数
与前面的建议相同,考虑到二分搜索代码细节的复杂性,如果非必要,不要自己手写,尽可能用编程语言提供的标准库函数

:::

Expand Down