-
Notifications
You must be signed in to change notification settings - Fork 14.3k
translation: Update binary_search_insertion.md and binary_search_edge.md #1554
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
Conversation
- The given array does not contain decimals, meaning we do not need to worry about how to handle equal situations. | ||
- Since this method introduces decimals, the variable `target` in the function needs to be changed to a floating point type (no change needed in Python). | ||
- Since the given array does not contain decimals, this means we do not need to worry about handling equal cases. | ||
- Because this method introduces decimals, the variable `target` in the function needs to be changed to a floating point type (no change needed in Python). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since has a slightly more formal tone than Because, Consider choosing one for consistency throughout the document."
1. Perform a binary search, get an arbitrary index of `target`, denoted as $k$. | ||
2. Start from index $k$, and perform a linear search to the left until the leftmost `target` is found and return. | ||
1. Perform a binary search to find any `target`'s index, say $k$. | ||
2. Starting from index $k$, perform a linear search to the left until the leftmost `target` is found and return. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The tenses of the two paragraphs are inconsistent. Perform and Starting
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Starting from index
@yanedie Please take a look at the updates. |
@krahets revert the title of chapter 10.2. This PR can be merged now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi yanedie
thank you for the hardwork.
below are my suggestions.... Some of them I refined it a bit to make it less wordy or it flows a bit better etc....
kind regards
|
||
 | ||
|
||
Please note, the insertion point returned is $i$, therefore, it should be subtracted by $1$ to obtain $j$: | ||
Note that the insertion point returned is $i$, therefore, it should be subtracted by $1$ to obtain $j$: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
7.1.3 of binary tree, uses "please note". @krahets, I think we may need to decide rather to change to just "note that" or "please note that" to keep it consistent across all chapters. This can be in the reviewer checklist as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@K3v123 I’m not sure if it’s necessary to maintain their consistency.
|
||
```src | ||
[file]{binary_search_insertion}-[class]{}-[func]{binary_search_insertion} | ||
``` | ||
|
||
!!! tip | ||
|
||
The code in this section uses "closed intervals". Readers interested can implement the "left-closed right-open" method themselves. | ||
The code in this section uses "closed interval". If you are interested in "left-closed, right-open", try to implement the code on your own. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"closed interval". If you are interested in "left-closed, right-open","
->
" closed interval approach. If you are interested in the left-closed, right-open method"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@krahets We may need to decide whether to convert "xxx" into xxx or discuss the conversion rule and add it to the checklist.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@yanedie I think it should match the CN version.
How about The code in this section uses the "closed interval" approach. If you are interested in the "left-closed, right-open" approach,
Oh, also, please check if I miss any '*' or quotation mark, as I hand typed those. Sorry for the inconvenience |
en/mkdocs.yml
Outdated
@@ -117,7 +117,7 @@ nav: | |||
# [icon: material/text-search] | |||
- chapter_searching/index.md | |||
- 10.1 Binary search: chapter_searching/binary_search.md | |||
- 10.2 Binary search insertion: chapter_searching/binary_search_insertion.md | |||
- 10.2 Binary search for insertion point: chapter_searching/binary_search_insertion.md |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The title here does not match the one in the document.
|
||
 | ||
|
||
Please note, the insertion point returned is $i$, therefore, it should be subtracted by $1$ to obtain $j$: | ||
Note that the insertion point returned is $i$, therefore, it should be subtracted by $1$ to obtain $j$: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@K3v123 I’m not sure if it’s necessary to maintain their consistency.
|
||
```src | ||
[file]{binary_search_insertion}-[class]{}-[func]{binary_search_insertion} | ||
``` | ||
|
||
!!! tip | ||
|
||
The code in this section uses "closed intervals". Readers interested can implement the "left-closed right-open" method themselves. | ||
The code in this section uses "closed interval". If you are interested in "left-closed, right-open", try to implement the code on your own. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@yanedie I think it should match the CN version.
How about The code in this section uses the "closed interval" approach. If you are interested in the "left-closed, right-open" approach,
|
||
Therefore, at the end of the binary, it is certain that: $i$ points to the first element greater than `target`, and $j$ points to the first element less than `target`. **It is easy to see that when the array does not contain `target`, the insertion index is $i$**. The code is as follows: | ||
Therefore, at the end of the binary, it is certain that: $i$ points to the first element greater than `target`, and $j$ points to the first element less than `target`. **It is easy to see that when the array does not contain `target`, the insertion point is $i$**. The code is as follows: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, please add it to the checklist. Thank you!
If this pull request (PR) pertains to Chinese-to-English translation, please confirm that you have read the contribution guidelines and complete the checklist below: