diff --git a/en/docs/chapter_appendix/contribution.assets/edit_markdown.png b/en/docs/chapter_appendix/contribution.assets/edit_markdown.png new file mode 100644 index 000000000..c11dce4fb Binary files /dev/null and b/en/docs/chapter_appendix/contribution.assets/edit_markdown.png differ diff --git a/en/docs/chapter_appendix/contribution.md b/en/docs/chapter_appendix/contribution.md new file mode 100644 index 000000000..276157844 --- /dev/null +++ b/en/docs/chapter_appendix/contribution.md @@ -0,0 +1,47 @@ +# Contributing + +Due to the limited abilities of the author, some omissions and errors are inevitable in this book. Please understand. If you discover any typos, broken links, missing content, textual ambiguities, unclear explanations, or unreasonable text structures, please assist us in making corrections to provide readers with better quality learning resources. + +The GitHub IDs of all [contributors](https://github.com/krahets/hello-algo/graphs/contributors) will be displayed on the repository, web, and PDF versions of the homepage of this book to thank them for their selfless contributions to the open-source community. + +!!! success "The charm of open source" + + The interval between two printings of a paper book is often long, making content updates very inconvenient. + + In this open-source book, however, the content update cycle is shortened to just a few days or even hours. + +### Content fine-tuning + +As shown in the figure below, there is an "edit icon" in the upper right corner of each page. You can follow these steps to modify text or code. + +1. Click the "edit icon". If prompted to "fork this repository", please agree to do so. +2. Modify the Markdown source file content, check the accuracy of the content, and try to keep the formatting consistent. +3. Fill in the modification description at the bottom of the page, then click the "Propose file change" button. After the page redirects, click the "Create pull request" button to initiate the pull request. + +![Edit page button](contribution.assets/edit_markdown.png) + +Images cannot be directly modified and require the creation of a new [Issue](https://github.com/krahets/hello-algo/issues) or a comment to describe the problem. We will redraw and replace the images as soon as possible. + +### Content creation + +If you are interested in participating in this open-source project, including translating code into other programming languages or expanding article content, then the following Pull Request workflow needs to be implemented. + +1. Log in to GitHub and Fork the [code repository](https://github.com/krahets/hello-algo) of this book to your personal account. +2. Go to your Forked repository web page and use the `git clone` command to clone the repository to your local machine. +3. Create content locally and perform complete tests to verify the correctness of the code. +4. Commit the changes made locally, then push them to the remote repository. +5. Refresh the repository webpage and click the "Create pull request" button to initiate the pull request. + +### Docker deployment + +In the `hello-algo` root directory, execute the following Docker script to access the project at `http://localhost:8000`: + +```shell +docker-compose up -d +``` + +Use the following command to remove the deployment: + +```shell +docker-compose down +``` diff --git a/en/docs/chapter_appendix/index.md b/en/docs/chapter_appendix/index.md new file mode 100644 index 000000000..3a0456dbf --- /dev/null +++ b/en/docs/chapter_appendix/index.md @@ -0,0 +1,3 @@ +# Appendix + +![Appendix](../assets/covers/chapter_appendix.jpg) diff --git a/en/docs/chapter_appendix/installation.assets/vscode_extension_installation.png b/en/docs/chapter_appendix/installation.assets/vscode_extension_installation.png new file mode 100644 index 000000000..3eabc83d0 Binary files /dev/null and b/en/docs/chapter_appendix/installation.assets/vscode_extension_installation.png differ diff --git a/en/docs/chapter_appendix/installation.assets/vscode_installation.png b/en/docs/chapter_appendix/installation.assets/vscode_installation.png new file mode 100644 index 000000000..b0e09d459 Binary files /dev/null and b/en/docs/chapter_appendix/installation.assets/vscode_installation.png differ diff --git a/en/docs/chapter_appendix/installation.md b/en/docs/chapter_appendix/installation.md new file mode 100644 index 000000000..e05a1b50b --- /dev/null +++ b/en/docs/chapter_appendix/installation.md @@ -0,0 +1,68 @@ +# Programming environment setup + +## Install IDE + +We recommend using the open-source, lightweight VS Code as your local Integrated Development Environment (IDE). Visit the [VS Code official website](https://code.visualstudio.com/) and choose the version of VS Code appropriate for your operating system to download and install. + +![Download VS Code from the official website](installation.assets/vscode_installation.png) + +VS Code has a powerful extension ecosystem, supporting the execution and debugging of most programming languages. For example, after installing the "Python Extension Pack," you can debug Python code. The installation steps are shown in the following figure. + +![Install VS Code Extension Pack](installation.assets/vscode_extension_installation.png) + +## Install language environments + +### Python environment + +1. Download and install [Miniconda3](https://docs.conda.io/en/latest/miniconda.html), requiring Python 3.10 or newer. +2. In the VS Code extension marketplace, search for `python` and install the Python Extension Pack. +3. (Optional) Enter `pip install black` in the command line to install the code formatting tool. + +### C/C++ environment + +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, so no installation is necessary. +2. In the VS Code extension marketplace, search for `c++` 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 }`. + +### Java environment + +1. Download and install [OpenJDK](https://jdk.java.net/18/) (version must be > JDK 9). +2. In the VS Code extension marketplace, search for `java` and install the Extension Pack for Java. + +### C# environment + +1. Download and install [.Net 8.0](https://dotnet.microsoft.com/en-us/download). +2. In the VS Code extension marketplace, search for `C# Dev Kit` and install the 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)). + +### Go environment + +1. Download and install [go](https://go.dev/dl/). +2. In the VS Code extension marketplace, search for `go` and install Go. +3. Press `Ctrl + Shift + P` to call up the command bar, enter go, choose `Go: Install/Update Tools`, select all and install. + +### Swift environment + +1. Download and install [Swift](https://www.swift.org/download/). +2. In the VS Code extension marketplace, search for `swift` and install [Swift for Visual Studio Code](https://marketplace.visualstudio.com/items?itemName=sswg.swift-lang). + +### JavaScript environment + +1. Download and install [Node.js](https://nodejs.org/en/). +2. (Optional) In the VS Code extension marketplace, search for `Prettier` and install the code formatting tool. + +### TypeScript environment + +1. Follow the same installation steps as the JavaScript environment. +2. Install [TypeScript Execute (tsx)](https://github.com/privatenumber/tsx?tab=readme-ov-file#global-installation). +3. In the VS Code extension marketplace, search for `typescript` and install [Pretty TypeScript Errors](https://marketplace.visualstudio.com/items?itemName=yoavbls.pretty-ts-errors). + +### Dart environment + +1. Download and install [Dart](https://dart.dev/get-dart). +2. In the VS Code extension marketplace, search for `dart` and install [Dart](https://marketplace.visualstudio.com/items?itemName=Dart-Code.dart-code). + +### Rust environment + +1. Download and install [Rust](https://www.rust-lang.org/tools/install). +2. In the VS Code extension marketplace, search for `rust` and install [rust-analyzer](https://marketplace.visualstudio.com/items?itemName=rust-lang.rust-analyzer). diff --git a/en/docs/chapter_appendix/terminology.md b/en/docs/chapter_appendix/terminology.md new file mode 100644 index 000000000..f46133c81 --- /dev/null +++ b/en/docs/chapter_appendix/terminology.md @@ -0,0 +1,137 @@ +# Glossary + +The table below lists the important terms that appear in the book, and it is worth noting the following points. + +- It is recommended to remember the English names of the terms to facilitate reading English literature. +- Some terms have different names in Simplified and Traditional Chinese. + +

Table   Important Terms in Data Structures and Algorithms

+ +| 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 | 大 $O$ 记号 | 大 $O$ 記號 | +| 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 | AVL 树 | AVL 樹 | +| red-black tree | 红黑树 | 紅黑樹 | +| level-order traversal | 层序遍历 | 層序走訪 | +| breadth-first traversal | 广度优先遍历 | 廣度優先走訪 | +| depth-first traversal | 深度优先遍历 | 深度優先走訪 | +| binary search tree | 二叉搜索树 | 二元搜尋樹 | +| balanced binary search tree | 平衡二叉搜索树 | 平衡二元搜尋樹 | +| balance factor | 平衡因子 | 平衡因子 | +| heap | 堆 | 堆積 | +| max heap | 大顶堆 | 大頂堆積 | +| min heap | 小顶堆 | 小頂堆積 | +| priority queue | 优先队列 | 優先佇列 | +| heapify | 堆化 | 堆積化 | +| top-$k$ problem | Top-$k$ 问题 | 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 | 分治 | 分治 | +| hanota problem | 汉诺塔问题 | 河內塔問題 | +| backtracking algorithm | 回溯算法 | 回溯演算法 | +| constraint | 约束 | 約束 | +| solution | 解 | 解 | +| state | 状态 | 狀態 | +| pruning | 剪枝 | 剪枝 | +| permutations problem | 全排列问题 | 全排列問題 | +| subset-sum problem | 子集和问题 | 子集合問題 | +| $n$-queens problem | $n$ 皇后问题 | $n$ 皇后問題 | +| dynamic programming | 动态规划 | 動態規劃 | +| initial state | 初始状态 | 初始狀態 | +| state-transition equation | 状态转移方程 | 狀態轉移方程 | +| knapsack problem | 背包问题 | 背包問題 | +| edit distance problem | 编辑距离问题 | 編輯距離問題 | +| greedy algorithm | 贪心算法 | 貪婪演算法 |