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

translation: refine translation of chapter_heap/summary.md #1383

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

yuelinxin
Copy link
Contributor

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.

If this pull request (PR) is associated with coding or code transpilation, please attach the relevant console outputs to the PR and complete the following checklist:

  • I have thoroughly reviewed the code, focusing on its formatting, comments, indentation, and file headers.
  • I have confirmed that the code execution outputs are consistent with those produced by the reference code (Python or Java).
  • The code is designed to be compatible on standard operating systems, including Windows, macOS, and Ubuntu.

@yuelinxin yuelinxin changed the title refine translation of heap/summary.md translation: refine translation of heap/summary.md Jun 9, 2024
@yuelinxin yuelinxin changed the title translation: refine translation of heap/summary.md translation: refine translation of chapter_heap/summary.md Jun 9, 2024
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.

looks good to me, below is optional for more clarity but it may kind of break the accuracy of CN ver.

@@ -2,16 +2,16 @@

### Key review

- A heap is a complete binary tree, which can be divided into a max heap and a min heap based on its property. The top element of a max (min) heap is the largest (smallest).
- A heap is a complete binary tree, which can be divided into a max heap and a min heap based on its building property. The top element of a max (min) heap is the largest (smallest).
Copy link
Contributor

Choose a reason for hiding this comment

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

optional (this may kind of break the accuracy of the translation but give a bit better clarity):
The translation is accurate but could be refined for clarity. Consider
"A heap is a complete binary tree, which can be divided into a max heap and a min heap based on its building property. The top element of a max (min) heap is the largest (smallest)"
->
"A heap is a complete binary tree that can be categorized as either a max heap or a min heap based on its building property."

@@ -2,16 +2,16 @@

### Key review

- A heap is a complete binary tree, which can be divided into a max heap and a min heap based on its property. The top element of a max (min) heap is the largest (smallest).
- A heap is a complete binary tree, which can be divided into a max heap and a min heap based on its building property. The top element of a max (min) heap is the largest (smallest).
- A priority queue is defined as a queue with dequeue priority, usually implemented using a heap.
- Common operations of a heap and their corresponding time complexities include: element insertion into the heap $O(\log n)$, removing the top element from the heap $O(\log n)$, and accessing the top element of the heap $O(1)$.

Choose a reason for hiding this comment

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

In this sentence we use the plural possessive 'their' but we are referring to 'a heap' (which is singular). Change to either

  • Common operations of a heap and its corresponding time complexities include:
  • Common operations of heaps and their corresponding time complexities

In my opinion, I think the first option is better.

- Top-k is a classic algorithm problem that can be efficiently solved using the heap data structure, with a time complexity of $O(n \log k)$.

### Q & A

**Q**: Is the "heap" in data structures the same concept as the "heap" in memory management?

The two are not the same concept, even though they are both referred to as "heap". The heap in computer system memory is part of dynamic memory allocation, where the program can use it to store data during execution. The program can request a certain amount of heap memory to store complex structures like objects and arrays. When these data are no longer needed, the program needs to release this memory to prevent memory leaks. Compared to stack memory, the management and usage of heap memory need to be more cautious, as improper use may lead to memory leaks and dangling pointers.
The two are not the same concept, even though they are both referred to as "heap". The heap in computer system memory is part of dynamic memory allocation, where the program can use it to store data during execution. The program can request a certain amount of heap memory to store complex structures like objects and arrays. When these data are no longer needed, the program needs to release this memory to prevent memory leaks. Compared to stack memory, the management and usage of heap memory demands more caution, as improper use may lead to memory leaks and dangling pointers.
Copy link

@RafaelCaso RafaelCaso Jun 14, 2024

Choose a reason for hiding this comment

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

Although 'data' is plural, we are referring to one 'set' of data so the sentence 'When these data are no longer needed' sounds very strange to me. I think 'When this data is no longer needed...' sounds much more natural.

This is one of the many strange quirks of the English language, I know this must seem strange for ESL speakers but 'data' should be treated as a singular unit. Would love to hear any thoughts on this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants