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: Update chap_tree/summary.md #1555

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

Conversation

steventimes
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.

@steventimes
Copy link
Contributor Author

I have changed some wording, and for line 37, since I do not know c++, I am not sure whether to use "function" or "method".

@steventimes steventimes changed the title Update summary.md translation: Update chap_tree/summary.md Nov 12, 2024
@yuelinxin
Copy link
Contributor

Functions defined in an object in cpp is usually referred as a “method”, this follows the terminology commonly accepted in object-oriented programming.

Copy link
Contributor

@yuelinxin yuelinxin left a comment

Choose a reason for hiding this comment

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

Great work! Please consider my comment on the title and also the function terminology.

@@ -1,26 +1,26 @@
# Summary

### Key review
### Key Highlights
Copy link
Contributor

Choose a reason for hiding this comment

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

we have fixed this title throughout this book so no need to change this

@steventimes
Copy link
Contributor Author

I have updated the file with the changed title, and named back to "method". Thank you

Copy link
Contributor

@yuelinxin yuelinxin left a comment

Choose a reason for hiding this comment

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

Great work, thank you!

@@ -3,24 +3,24 @@
### Key review

- A binary tree is a non-linear data structure that reflects the "divide and conquer" logic of splitting one into two. Each binary tree node contains a value and two pointers, which point to its left and right child nodes, respectively.
- For a node in a binary tree, the tree formed by its left (right) child node and all nodes under it is called the node's left (right) subtree.
- Related terminology of binary trees includes root node, leaf node, level, degree, edge, height, and depth, among others.
- For a node in a binary tree, its left (right) child node and the tree formed below it is called the node's left (right) subtree.
Copy link
Contributor

Choose a reason for hiding this comment

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

"is called" => "are collectively called"

- The operations of initializing a binary tree, inserting nodes, and removing nodes are similar to those of linked list operations.
- Common types of binary trees include perfect binary trees, complete binary trees, full binary trees, and balanced binary trees. The perfect binary tree represents the ideal state, while the linked list is the worst state after degradation.
- A binary tree can be represented using an array by arranging the node values and empty slots in a level-order traversal sequence and implementing pointers based on the index mapping relationship between parent nodes and child nodes.
- The level-order traversal of a binary tree is a breadth-first search method, which reflects a layer-by-layer traversal manner of "expanding circle by circle." It is usually implemented using a queue.
- Pre-order, in-order, and post-order traversals are all depth-first search methods, reflecting the traversal manner of "going to the end first, then backtracking to continue." They are usually implemented using recursion.
- A binary search tree is an efficient data structure for element searching, with the time complexity of search, insert, and remove operations all being $O(\log n)$. When a binary search tree degrades into a linked list, these time complexities deteriorate to $O(n)$.
- An AVL tree, also known as a balanced binary search tree, ensures that the tree remains balanced after continuous node insertions and removals through rotation operations.
- Rotation operations in an AVL tree include right rotation, left rotation, right-then-left rotation, and left-then-right rotation. After inserting or removing nodes, an AVL tree performs rotation operations from bottom to top to rebalance the tree.
- Rotation operations in an AVL tree include right rotation, left rotation, right-left rotation, and left-right rotation. After inserting or removing nodes, the AVL tree performs rotation operations from bottom to top to rebalance the tree.
Copy link
Contributor

Choose a reason for hiding this comment

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

If you use "inserting/removing", the subject should be "we". How about updating this to "After node insertion or removal, the AVL tree rebalances itself by performing these rotations in a bottom-up manner."?


### Q & A

**Q**: For a binary tree with only one node, are both the height of the tree and the depth of the root node $0$?

Yes, because height and depth are typically defined as "the number of edges passed."

**Q**: The insertion and removal in a binary tree are generally completed by a set of operations. What does "a set of operations" refer to here? Can it be understood as the release of resources of the child nodes?
**Q**: The insertion and removal in a binary tree are generally accomplished by a set of operations. What does "a set of operations" refer to here? Can it be understood as the release of resources of the child nodes?
Copy link
Contributor

Choose a reason for hiding this comment

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

Can it be understood...? => Does it imply releasing the resources of the child nodes?

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.

3 participants