Skip to content

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

Merged
merged 12 commits into from
Feb 14, 2025

Conversation

yanedie
Copy link
Contributor

@yanedie yanedie commented Nov 11, 2024

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:

  • This PR represents the translation of a single, complete document, or contains only bug fixes.
  • The translation accurately conveys the original meaning and intent of the Chinese version. If deviations exist, I have provided explanatory comments to clarify the reasons.

@yanedie yanedie requested review from ofou December 3, 2024 14:36
- 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).
Copy link
Contributor

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.
Copy link
Contributor

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Starting from index $k$" is a present participial phrase. Their tenses are the same.

@yanedie yanedie requested a review from pengchzn December 6, 2024 13:39
@krahets
Copy link
Owner

krahets commented Jan 21, 2025

@yanedie Please take a look at the updates.

@yanedie
Copy link
Contributor Author

yanedie commented Feb 2, 2025

@krahets revert the title of chapter 10.2. This PR can be merged now.

@yanedie yanedie changed the title translation: Update binary_search_insertion.md translation: Update binary_search_insertion.md and binary_search_edge.md Feb 2, 2025
Copy link
Contributor

@K3v123 K3v123 left a 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


![Transforming the search for the right boundary into the search for the left boundary](binary_search_edge.assets/binary_search_right_edge_by_left_edge.png)

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$:
Copy link
Contributor

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.

Copy link
Owner

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.
Copy link
Contributor

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"

Copy link
Contributor Author

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.

Copy link
Owner

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,

@K3v123
Copy link
Contributor

K3v123 commented Feb 3, 2025

Oh, also, please check if I miss any '*' or quotation mark, as I hand typed those.

Sorry for the inconvenience

@krahets krahets added translation English translation documents documents-related labels Feb 14, 2025
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
Copy link
Owner

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.


![Transforming the search for the right boundary into the search for the left boundary](binary_search_edge.assets/binary_search_right_edge_by_left_edge.png)

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$:
Copy link
Owner

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.
Copy link
Owner

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:
Copy link
Owner

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!

@krahets krahets merged commit 4ff889c into krahets:main Feb 14, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documents documents-related translation English translation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants