This commit is contained in:
krahets
2024-04-06 03:02:20 +08:00
parent 0a9daa8b9f
commit 8d37c215c8
148 changed files with 70398 additions and 408 deletions

View File

@ -0,0 +1,53 @@
---
comments: true
---
# 16.2   一起參與創作
由於筆者能力有限,書中難免存在一些遺漏和錯誤,請您諒解。如果您發現了筆誤、連結失效、內容缺失、文字歧義、解釋不清晰或行文結構不合理等問題,請協助我們進行修正,以給讀者提供更優質的學習資源。
所有[撰稿人](https://github.com/krahets/hello-algo/graphs/contributors)的 GitHub ID 將在本書倉庫、網頁版和 PDF 版的主頁上進行展示,以感謝他們對開源社群的無私奉獻。
!!! success "開源的魅力"
紙質圖書的兩次印刷的間隔時間往往較久,內容更新非常不方便。
而在本開源書中,內容更迭的時間被縮短至數日甚至幾個小時。
### 1.   內容微調
如圖 16-3 所示,每個頁面的右上角都有“編輯圖示”。您可以按照以下步驟修改文字或程式碼。
1. 點選“編輯圖示”,如果遇到“需要 Fork 此倉庫”的提示,請同意該操作。
2. 修改 Markdown 源檔案內容,檢查內容的正確性,並儘量保持排版格式的統一。
3. 在頁面底部填寫修改說明然後點選“Propose file change”按鈕。頁面跳轉後點選“Create pull request”按鈕即可發起拉取請求。
![頁面編輯按鍵](contribution.assets/edit_markdown.png){ class="animation-figure" }
<p align="center"> 圖 16-3 &nbsp; 頁面編輯按鍵 </p>
圖片無法直接修改,需要透過新建 [Issue](https://github.com/krahets/hello-algo/issues) 或評論留言來描述問題,我們會盡快重新繪製並替換圖片。
### 2. &nbsp; 內容創作
如果您有興趣參與此開源專案,包括將程式碼翻譯成其他程式語言、擴展文章內容等,那麼需要實施以下 Pull Request 工作流程。
1. 登入 GitHub ,將本書的[程式碼倉庫](https://github.com/krahets/hello-algo) Fork 到個人帳號下。
2. 進入您的 Fork 倉庫網頁,使用 `git clone` 命令將倉庫克隆至本地。
3. 在本地進行內容創作,並進行完整測試,驗證程式碼的正確性。
4. 將本地所做更改 Commit ,然後 Push 至遠端倉庫。
5. 重新整理倉庫網頁點選“Create pull request”按鈕即可發起拉取請求。
### 3. &nbsp; Docker 部署
`hello-algo` 根目錄下,執行以下 Docker 指令碼,即可在 `http://localhost:8000` 訪問本專案:
```shell
docker-compose up -d
```
使用以下命令即可刪除部署:
```shell
docker-compose down
```

View File

@ -0,0 +1,14 @@
---
comments: true
icon: material/help-circle-outline
---
# 第 16 章 &nbsp; 附錄
![附錄](../assets/covers/chapter_appendix.jpg){ class="cover-image" }
## Chapter Contents
- [16.1 &nbsp; 程式設計環境安裝](https://www.hello-algo.com/en/chapter_appendix/installation/)
- [16.2 &nbsp; 一起參與創作](https://www.hello-algo.com/en/chapter_appendix/contribution/)
- [16.3 &nbsp; 術語表](https://www.hello-algo.com/en/chapter_appendix/terminology/)

View File

@ -0,0 +1,71 @@
---
comments: true
---
# 16.1 &nbsp; 程式設計環境安裝
## 16.1.1 &nbsp; 安裝 IDE
推薦使用開源、輕量的 VS Code 作為本地整合開發環境IDE。訪問 [VS Code 官網](https://code.visualstudio.com/),根據作業系統選擇相應版本的 VS Code 進行下載和安裝。
![從官網下載 VS Code](installation.assets/vscode_installation.png){ class="animation-figure" }
<p align="center"> 圖 16-1 &nbsp; 從官網下載 VS Code </p>
VS Code 擁有強大的擴展包生態系統,支持大多數程式語言的執行和除錯。以 Python 為例安裝“Python Extension Pack”擴展包之後即可進行 Python 程式碼除錯。安裝步驟如圖 16-2 所示。
![安裝 VS Code 擴展包](installation.assets/vscode_extension_installation.png){ class="animation-figure" }
<p align="center"> 圖 16-2 &nbsp; 安裝 VS Code 擴展包 </p>
## 16.1.2 &nbsp; 安裝語言環境
### 1. &nbsp; Python 環境
1. 下載並安裝 [Miniconda3](https://docs.conda.io/en/latest/miniconda.html) ,需要 Python 3.10 或更新版本。
2. 在 VS Code 的擴充功能市場中搜索 `python` ,安裝 Python Extension Pack 。
3. (可選)在命令列輸入 `pip install black` ,安裝程式碼格式化工具。
### 2. &nbsp; C/C++ 環境
1. Windows 系統需要安裝 [MinGW](https://sourceforge.net/projects/mingw-w64/files/)[配置教程](https://blog.csdn.net/qq_33698226/article/details/129031241)MacOS 自帶 Clang ,無須安裝。
2. 在 VS Code 的擴充功能市場中搜索 `c++` ,安裝 C/C++ Extension Pack 。
3. (可選)開啟 Settings 頁面,搜尋 `Clang_format_fallback Style` 程式碼格式化選項,設定為 `{ BasedOnStyle: Microsoft, BreakBeforeBraces: Attach }`
### 3. &nbsp; Java 環境
1. 下載並安裝 [OpenJDK](https://jdk.java.net/18/)(版本需滿足 > JDK 9
2. 在 VS Code 的擴充功能市場中搜索 `java` ,安裝 Extension Pack for Java 。
### 4. &nbsp; C# 環境
1. 下載並安裝 [.Net 8.0](https://dotnet.microsoft.com/en-us/download) 。
2. 在 VS Code 的擴充功能市場中搜索 `C# Dev Kit` ,安裝 C# Dev Kit [配置教程](https://code.visualstudio.com/docs/csharp/get-started))。
3. 也可使用 Visual Studio[安裝教程](https://learn.microsoft.com/zh-cn/visualstudio/install/install-visual-studio?view=vs-2022))。
### 5. &nbsp; Go 環境
1. 下載並安裝 [go](https://go.dev/dl/) 。
2. 在 VS Code 的擴充功能市場中搜索 `go` ,安裝 Go 。
3. 按快捷鍵 `Ctrl + Shift + P` 撥出命令欄,輸入 go ,選擇 `Go: Install/Update Tools` ,全部勾選並安裝即可。
### 6. &nbsp; Swift 環境
1. 下載並安裝 [Swift](https://www.swift.org/download/) 。
2. 在 VS Code 的擴充功能市場中搜索 `swift` ,安裝 [Swift for Visual Studio Code](https://marketplace.visualstudio.com/items?itemName=sswg.swift-lang) 。
### 7. &nbsp; JavaScript 環境
1. 下載並安裝 [node.js](https://nodejs.org/en/) 。
2. 在 VS Code 的擴充功能市場中搜索 `javascript` ,安裝 JavaScript (ES6) code snippets 。
3. (可選)在 VS Code 的擴充功能市場中搜索 `Prettier` ,安裝程式碼格式化工具。
### 8. &nbsp; Dart 環境
1. 下載並安裝 [Dart](https://dart.dev/get-dart) 。
2. 在 VS Code 的擴充功能市場中搜索 `dart` ,安裝 [Dart](https://marketplace.visualstudio.com/items?itemName=Dart-Code.dart-code) 。
### 9. &nbsp; Rust 環境
1. 下載並安裝 [Rust](https://www.rust-lang.org/tools/install) 。
2. 在 VS Code 的擴充功能市場中搜索 `rust` ,安裝 [rust-analyzer](https://marketplace.visualstudio.com/items?itemName=rust-lang.rust-analyzer) 。

View File

@ -0,0 +1,144 @@
---
comments: true
---
# 16.3 &nbsp; 術語表
表 16-1 列出了書中出現的重要術語,值得注意以下幾點。
- 建議記住名詞的英文叫法,以便閱讀英文文獻。
- 部分名詞在簡體中文和繁體中文下的叫法不同。
<p align="center"> 表 16-1 &nbsp; 資料結構與演算法的重要名詞 </p>
<div class="center-table" markdown>
| 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 | 原码 | 原碼 |
| 1s complement | 反码 | 一補數 |
| 2s 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 | 哈希表 | 雜湊表 |
| 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 | 贪心算法 | 貪婪演算法 |
</div>