Revisit the English version (#1885)

* Update giscus scroller.

* Refine English docs and landing page

* Sync the headings.

* Update landing pages.

* Update the avatar

* Update Acknowledgements

* Update landing pages.

* Update contributors.

* Update

* Fix the formula formatting.

* Fix the glossary.

* Chapter 6. Hashing

* Remove Chinese chars.

* Fix headings.

* Update giscus themes.

* fallback to default giscus theme to solve 429 many requests error.

* Add borders for callouts.

* docs: sync character encoding translations

* Update landing page media layout and i18n
This commit is contained in:
Yudong Jin
2026-04-10 23:03:03 +08:00
committed by GitHub
parent ae03a167a4
commit b01036b09e
132 changed files with 1702 additions and 1508 deletions
@@ -1,6 +1,6 @@
# Array Representation of Binary Trees
Under the linked list representation, the storage unit of a binary tree is a node `TreeNode`, and nodes are connected by pointers. The previous section introduced the basic operations of binary trees under the linked list representation.
In the linked-list representation, the storage unit of a binary tree is a node `TreeNode`, and nodes are connected by pointers. The previous section introduced the basic operations of binary trees in this representation.
So, can we use an array to represent a binary tree? The answer is yes.
@@ -22,7 +22,7 @@ As shown in the figure below, given a non-perfect binary tree, the above method
![Level-order traversal sequence corresponds to multiple binary tree possibilities](array_representation_of_tree.assets/array_representation_without_empty.png)
To solve this problem, **we can consider explicitly writing out all `None` values in the level-order traversal sequence**. As shown in the figure below, after this treatment, the level-order traversal sequence can uniquely represent a binary tree. Example code is as follows:
To solve this problem, **we can explicitly write out all `None` values in the level-order traversal sequence**. As shown in the figure below, once we do this, the level-order traversal sequence can uniquely represent a binary tree. Example code is as follows:
=== "Python"
@@ -128,7 +128,7 @@ To solve this problem, **we can consider explicitly writing out all `None` value
tree = [1, 2, 3, 4, nil, 6, 7, 8, 9, nil, nil, 12, nil, nil, 15]
```
![Array representation of any type of binary tree](array_representation_of_tree.assets/array_representation_with_empty.png)
![Array representation of an arbitrary binary tree](array_representation_of_tree.assets/array_representation_with_empty.png)
It's worth noting that **complete binary trees are very well-suited for array representation**. Recalling the definition of a complete binary tree, `None` only appears at the bottom level and towards the right, **meaning all `None` values must appear at the end of the level-order traversal sequence**.
@@ -136,9 +136,9 @@ This means that when using an array to represent a complete binary tree, it's po
![Array representation of a complete binary tree](array_representation_of_tree.assets/array_representation_complete_binary_tree.png)
The following code implements a binary tree based on array representation, including the following operations:
The following code implements a binary tree using an array representation, including the following operations:
- Given a certain node, obtain its value, left (right) child node, and parent node.
- Given a node, obtain its value, left (right) child node, and parent node.
- Obtain the preorder, inorder, postorder, and level-order traversal sequences.
```src