Retranslate the complete English edition from Simplified Chinese (#2010)

* Retranslate the complete English edition from Simplified Chinese

* Polish three English explanations after reader-focused review
This commit is contained in:
Yudong Jin
2026-10-31 03:35:51 +08:00
committed by GitHub
parent ef46e2ed95
commit 14c314c08c
1502 changed files with 29459 additions and 23517 deletions

View File

@@ -1,40 +1,40 @@
# Contributing Together
# Contribute to the book
Due to limited capacity, there may be inevitable omissions and errors in this book. We appreciate your understanding and are grateful for your help in correcting them. If you discover typos, broken links, missing content, ambiguous wording, unclear explanations, or structural issues, please help us make corrections to provide readers with higher-quality learning resources.
Despite the author's best efforts, this book may contain omissions and errors. Thank you for your understanding. If you find typos, broken links, missing content, ambiguous wording, unclear explanations, or poorly organized passages, please help us correct them so that we can provide a better learning resource.
The GitHub IDs of all [contributors](https://github.com/krahets/hello-algo/graphs/contributors) will be displayed on the homepage of the book repository, the web version, and the PDF version to acknowledge their selfless contributions to the open source community.
To thank everyone for their generous contributions to the open-source community, the GitHub IDs of all [contributors](https://github.com/krahets/hello-algo/graphs/contributors) are displayed on the home pages of the book's repository, website, and PDF edition.
!!! success "The Charm of Open Source"
!!! success "The beauty of open source"
The interval between two printings of a physical book is often quite long, making content updates very inconvenient.
Printed books often have long intervals between print runs, making their content difficult to update.
In this open-source book, updates can be made within days or even hours.
In this open source book, the time for content updates has been shortened to just days or even hours.
### Small edits
### Minor Content Adjustments
As shown in the figure below, each page has an edit icon in its upper-right corner. Follow these steps to edit text or code.
As shown in the figure below, there is an "edit icon" in the top-right corner of each page. You can modify text or code by following these steps.
1. Click the "edit icon". If you encounter a prompt asking you to "Fork this repository", please approve the operation.
2. Modify the content of the Markdown source file, verify the correctness of the content, and maintain consistent formatting as much as possible.
3. Fill in a description of your changes at the bottom of the page, then click the "Propose file change" button. After the new page loads, click the "Create pull request" button to submit your pull request.
1. Click the edit icon. If you are prompted to fork the repository, agree to do so.
2. Edit the Markdown source file, check that the content is correct, and keep the formatting as consistent as possible.
3. Enter a description of your changes at the bottom of the page, then click "Propose file change". On the next page, click "Create pull request" to submit your pull request.
![Page edit button](contribution.assets/edit_markdown.png)
Images cannot be directly modified. Please describe the issue by creating a new [Issue](https://github.com/krahets/hello-algo/issues) or leaving a comment. We will promptly redraw and replace the images.
Images cannot be edited directly. Please describe the problem in a new [issue](https://github.com/krahets/hello-algo/issues) or a comment, and we will redraw and replace the image as soon as possible.
### Content Creation
### Creating content
If you are interested in contributing to this open source project, including translating code into other programming languages or expanding article content, you will need to follow the Pull Request workflow below.
If you would like to contribute to this open-source project, for example by translating code into another programming language or expanding an article, follow this pull request workflow.
1. Log in to GitHub and Fork the book's [code repository](https://github.com/krahets/hello-algo) to your personal account.
2. Go to your forked repository page and use the `git clone` command to clone the repository to your local machine.
3. Create content locally and conduct comprehensive tests to verify code correctness.
4. Commit your local changes and push them to the remote repository.
5. Refresh the repository webpage and click the "Create pull request" button to submit your pull request.
1. Sign in to GitHub and fork the book's [code repository](https://github.com/krahets/hello-algo) to your own account.
2. Open your fork's repository page and use `git clone` to clone it to your computer.
3. Create your content locally and test it thoroughly to verify that the code is correct.
4. Commit your local changes, then push them to your remote repository.
5. Refresh the repository page and click "Create pull request" to submit your pull request.
### Docker Deployment
### Deploying with Docker
From the root directory of `hello-algo`, run the following Docker command to access the project at `http://localhost:8000`:
Run the following Docker command in the `hello-algo` root directory to access the English edition at `http://localhost:8000/en/`:
```shell
docker-compose up -d

View File

@@ -1,68 +1,68 @@
# Programming Environment Installation
# Setting up a programming environment
## Installing IDE
## Install an IDE
We recommend using the open-source and lightweight VS Code as the local integrated development environment (IDE). Visit the [VS Code official website](https://code.visualstudio.com/), and download and install the appropriate version of VS Code according to your operating system.
We recommend VS Code, a lightweight, open-source integrated development environment (IDE). Visit the [VS Code website](https://code.visualstudio.com/), then download and install the version for your operating system.
![Download VS Code from the Official Website](installation.assets/vscode_installation.png)
![Downloading VS Code from the official website](installation.assets/vscode_installation.png)
VS Code has a powerful ecosystem of extensions that supports running and debugging most programming languages. For example, after installing the "Python Extension Pack" extension, you can debug Python code. The installation steps are shown in the following figure.
VS Code has an extensive ecosystem of extensions that support running and debugging code in most programming languages. For example, installing the Python Extension Pack lets you debug Python code. The installation steps are shown in the figure below.
![Install VS Code Extensions](installation.assets/vscode_extension_installation.png)
![Installing VS Code extensions](installation.assets/vscode_extension_installation.png)
## Installing Language Environments
## Install a language environment
### Python Environment
### Python
1. Download and install [Miniconda3](https://docs.conda.io/en/latest/miniconda.html) with Python 3.10 or later.
2. Search for `python` in the VS Code extension marketplace and install the Python Extension Pack.
3. (Optional) Enter `pip install black` on the command line to install the code formatter.
1. Download and install [Miniconda3](https://docs.conda.io/en/latest/miniconda.html). Python 3.10 or later is required.
2. Search for `python` in the VS Code Extensions Marketplace and install Python Extension Pack.
3. (Optional) Run `pip install black` in a terminal to install a code formatter.
### C/C++ Environment
### C/C++
1. Windows systems need to install [MinGW](https://sourceforge.net/projects/mingw-w64/files/) ([configuration tutorial](https://blog.csdn.net/qq_33698226/article/details/129031241)); macOS comes with Clang built-in and does not require installation.
2. Search for `c++` in the VS Code extension marketplace and install the C/C++ Extension Pack.
3. (Optional) Open the Settings page, search for the `Clang_format_fallback Style` code formatting option, and set it to `{ BasedOnStyle: Microsoft, BreakBeforeBraces: Attach }`.
1. On Windows, install [MinGW](https://sourceforge.net/projects/mingw-w64/files/) ([setup guide](https://blog.csdn.net/qq_33698226/article/details/129031241)). macOS comes with Clang, so no installation is needed.
2. Search for `c++` in the VS Code Extensions Marketplace and install C/C++ Extension Pack.
3. (Optional) Open Settings, search for the `Clang_format_fallback Style` formatting option, and set it to `{ BasedOnStyle: Microsoft, BreakBeforeBraces: Attach }`.
### Java Environment
### Java
1. Download and install [OpenJDK](https://jdk.java.net/18/) (version 10 or later).
2. Search for `java` in the VS Code extension marketplace and install the Extension Pack for Java.
1. Download and install [OpenJDK](https://jdk.java.net/18/) (a version later than JDK 9 is required).
2. Search for `java` in the VS Code Extensions Marketplace and install Extension Pack for Java.
### C# Environment
### C\#
1. Download and install [.NET 8.0](https://dotnet.microsoft.com/en-us/download).
2. Search for `C# Dev Kit` in the VS Code extension marketplace and install C# Dev Kit ([configuration tutorial](https://code.visualstudio.com/docs/csharp/get-started)).
3. You can also use Visual Studio ([installation tutorial](https://learn.microsoft.com/zh-cn/visualstudio/install/install-visual-studio?view=vs-2022)).
2. Search for `C# Dev Kit` in the VS Code Extensions Marketplace and install C# Dev Kit ([setup guide](https://code.visualstudio.com/docs/csharp/get-started)).
3. You can also use Visual Studio ([installation guide](https://learn.microsoft.com/en-us/visualstudio/install/install-visual-studio?view=vs-2022)).
### Go Environment
### Go
1. Download and install [Go](https://go.dev/dl/).
2. Search for `go` in the VS Code extension marketplace and install Go.
3. Press `Ctrl + Shift + P` to open the command palette, type `go`, select `Go: Install/Update Tools`, check all options and install.
2. Search for `go` in the VS Code Extensions Marketplace and install Go.
3. Press `Ctrl + Shift + P` to open the Command Palette, enter go, select `Go: Install/Update Tools`, then select and install all the tools.
### Swift Environment
### Swift
1. Download and install [Swift](https://www.swift.org/download/).
2. Search for `swift` in the VS Code extension marketplace and install [Swift for Visual Studio Code](https://marketplace.visualstudio.com/items?itemName=sswg.swift-lang).
2. Search for `swift` in the VS Code Extensions Marketplace and install [Swift for Visual Studio Code](https://marketplace.visualstudio.com/items?itemName=sswg.swift-lang).
### JavaScript Environment
### JavaScript
1. Download and install [Node.js](https://nodejs.org/en/).
2. (Optional) Search for `Prettier` in the VS Code extension marketplace and install the code formatter.
2. (Optional) Search for `Prettier` in the VS Code Extensions Marketplace and install this code formatter.
### TypeScript Environment
### TypeScript
1. Follow the same installation steps as the JavaScript environment.
1. Follow the JavaScript environment setup steps.
2. Install [TypeScript Execute (tsx)](https://github.com/privatenumber/tsx?tab=readme-ov-file#global-installation).
3. Search for `typescript` in the VS Code extension marketplace and install [Pretty TypeScript Errors](https://marketplace.visualstudio.com/items?itemName=yoavbls.pretty-ts-errors).
3. Search for `typescript` in the VS Code Extensions Marketplace and install [Pretty TypeScript Errors](https://marketplace.visualstudio.com/items?itemName=yoavbls.pretty-ts-errors).
### Dart Environment
### Dart
1. Download and install [Dart](https://dart.dev/get-dart).
2. Search for `dart` in the VS Code extension marketplace and install [Dart](https://marketplace.visualstudio.com/items?itemName=Dart-Code.dart-code).
2. Search for `dart` in the VS Code Extensions Marketplace and install [Dart](https://marketplace.visualstudio.com/items?itemName=Dart-Code.dart-code).
### Rust Environment
### Rust
1. Download and install [Rust](https://www.rust-lang.org/tools/install).
2. Search for `rust` in the VS Code extension marketplace and install [rust-analyzer](https://marketplace.visualstudio.com/items?itemName=rust-lang.rust-analyzer).
2. Search for `rust` in the VS Code Extensions Marketplace and install [rust-analyzer](https://marketplace.visualstudio.com/items?itemName=rust-lang.rust-analyzer).

View File

@@ -1,136 +1,136 @@
# Glossary
The following table lists important terms that appear in this book.
The table below lists important terms used in this book. Familiarity with their English names will help when reading technical literature in English.
<p align="center"> Table <id> &nbsp; Important Terms in Data Structures and Algorithms </p>
<p align="center"> Table <id> &nbsp; Key terms in data structures and algorithms </p>
| English |
| ------------------------------ |
| algorithm |
| data structure |
| code |
| file |
| function |
| method |
| variable |
| asymptotic complexity analysis |
| time complexity |
| space complexity |
| loop |
| iteration |
| recursion |
| tail recursion |
| recursion tree |
| big-$O$ notation |
| asymptotic upper bound |
| sign-magnitude |
| 1’s complement |
| 2’s complement |
| array |
| index |
| linked list |
| linked list node, list node |
| head node |
| tail node |
| list |
| dynamic array |
| hard disk |
| random-access memory (RAM) |
| cache memory |
| cache miss |
| cache hit rate |
| stack |
| top of the stack |
| bottom of the stack |
| queue |
| double-ended queue |
| front of the queue |
| rear of the queue |
| hash table |
| hash set |
| bucket |
| hash function |
| hash collision |
| load factor |
| separate chaining |
| open addressing |
| linear probing |
| lazy deletion |
| binary tree |
| tree node |
| left-child node |
| right-child node |
| parent node |
| left subtree |
| right subtree |
| root node |
| leaf node |
| edge |
| level |
| degree |
| height |
| depth |
| perfect binary tree |
| complete binary tree |
| full binary tree |
| balanced binary tree |
| binary search tree |
| AVL tree |
| red-black tree |
| level-order traversal |
| breadth-first traversal |
| depth-first traversal |
| pre-order traversal |
| in-order traversal |
| post-order traversal |
| balanced binary search tree |
| balance factor |
| heap |
| max heap |
| min heap |
| priority queue |
| heapify |
| top-$k$ problem |
| graph |
| vertex |
| undirected graph |
| directed graph |
| connected graph |
| disconnected graph |
| weighted graph |
| adjacency |
| path |
| in-degree |
| out-degree |
| adjacency matrix |
| adjacency list |
| breadth-first search |
| depth-first search |
| binary search |
| searching algorithm |
| sorting algorithm |
| selection sort |
| bubble sort |
| insertion sort |
| quick sort |
| merge sort |
| heap sort |
| bucket sort |
| counting sort |
| radix sort |
| divide and conquer |
| Tower of Hanoi problem |
| backtracking algorithm |
| constraint |
| solution |
| state |
| pruning |
| permutations problem |
| subset-sum problem |
| $n$-queens problem |
| dynamic programming |
| initial state |
| state-transition equation |
| knapsack problem |
| edit distance problem |
| greedy algorithm |
| English | Simplified Chinese |
| ------------------------------ | -------------- |
| algorithm | 算法 |
| data structure | 数据结构 |
| code | 代码 |
| file | 文件 |
| function | 函数 |
| method | 方法 |
| variable | 变量 |
| asymptotic complexity analysis | 渐近复杂度分析 |
| time complexity | 时间复杂度 |
| space complexity | 空间复杂度 |
| loop | 循环 |
| iteration | 迭代 |
| recursion | 递归 |
| tail recursion | 尾递归 |
| recursion tree | 递归树 |
| big-$O$ notation | 大 $O$ 记号 |
| asymptotic upper bound | 渐近上界 |
| sign-magnitude | 原码 |
| one's complement | 反码 |
| two's complement | 补码 |
| array | 数组 |
| index | 索引 |
| linked list | 链表 |
| linked list node, list node | 链表节点 |
| head node | 头节点 |
| tail node | 尾节点 |
| list | 列表 |
| dynamic array | 动态数组 |
| hard disk | 硬盘 |
| random-access memory (RAM) | 内存 |
| cache memory | 缓存 |
| cache miss | 缓存未命中 |
| cache hit rate | 缓存命中率 |
| stack | 栈 |
| top of the stack | 栈顶 |
| bottom of the stack | 栈底 |
| queue | 队列 |
| double-ended queue | 双向队列 |
| front of the queue | 队首 |
| rear of the queue | 队尾 |
| hash table | 哈希表 |
| hash set | 哈希集合 |
| bucket | 桶 |
| hash function | 哈希函数 |
| hash collision | 哈希冲突 |
| load factor | 负载因子 |
| separate chaining | 链式地址 |
| open addressing | 开放寻址 |
| linear probing | 线性探测 |
| lazy deletion | 懒删除 |
| binary tree | 二叉树 |
| tree node | 树节点 |
| left-child node | 左子节点 |
| right-child node | 右子节点 |
| parent node | 父节点 |
| left subtree | 左子树 |
| right subtree | 右子树 |
| root node | 根节点 |
| leaf node | 叶节点 |
| edge | 边 |
| level | 层 |
| degree | 度 |
| height | 高度 |
| depth | 深度 |
| perfect binary tree | 完美二叉树 |
| complete binary tree | 完全二叉树 |
| full binary tree | 完满二叉树 |
| balanced binary tree | 平衡二叉树 |
| binary search tree | 二叉搜索树 |
| AVL tree | AVL 树 |
| red-black tree | 红黑树 |
| level-order traversal | 层序遍历 |
| breadth-first traversal | 广度优先遍历 |
| depth-first traversal | 深度优先遍历 |
| preorder traversal | 前序遍历 |
| inorder traversal | 中序遍历 |
| postorder traversal | 后序遍历 |
| balanced binary search tree | 平衡二叉搜索树 |
| balance factor | 平衡因子 |
| heap | 堆 |
| max heap | 大顶堆 |
| min heap | 小顶堆 |
| priority queue | 优先队列 |
| heapify | 堆化 |
| top-$k$ problem | Top-$k$ 问题 |
| graph | 图 |
| vertex | 顶点 |
| undirected graph | 无向图 |
| directed graph | 有向图 |
| connected graph | 连通图 |
| disconnected graph | 非连通图 |
| weighted graph | 有权图 |
| adjacency | 邻接 |
| path | 路径 |
| in-degree | 入度 |
| out-degree | 出度 |
| adjacency matrix | 邻接矩阵 |
| adjacency list | 邻接表 |
| breadth-first search | 广度优先搜索 |
| depth-first search | 深度优先搜索 |
| binary search | 二分查找 |
| searching algorithm | 搜索算法 |
| sorting algorithm | 排序算法 |
| selection sort | 选择排序 |
| bubble sort | 冒泡排序 |
| insertion sort | 插入排序 |
| quick sort | 快速排序 |
| merge sort | 归并排序 |
| heap sort | 堆排序 |
| bucket sort | 桶排序 |
| counting sort | 计数排序 |
| radix sort | 基数排序 |
| divide and conquer | 分治 |
| Tower of Hanoi problem | 汉诺塔问题 |
| backtracking algorithm | 回溯算法 |
| constraint | 约束 |
| solution | 解 |
| state | 状态 |
| pruning | 剪枝 |
| permutations problem | 全排列问题 |
| subset-sum problem | 子集和问题 |
| $n$-queens problem | $n$ 皇后问题 |
| dynamic programming | 动态规划 |
| initial state | 初始状态 |
| state transition equation | 状态转移方程 |
| knapsack problem | 背包问题 |
| edit distance problem | 编辑距离问题 |
| greedy algorithm | 贪心算法 |