mirror of
https://github.com/krahets/hello-algo.git
synced 2026-07-25 04:26:07 +00:00
build
This commit is contained in:
@@ -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”按鈕即可發起拉取請求。
|
||||
|
||||
{ class="animation-figure" }
|
||||
|
||||
<p align="center"> 圖 16-3 頁面編輯按鍵 </p>
|
||||
|
||||
圖片無法直接修改,需要透過新建 [Issue](https://github.com/krahets/hello-algo/issues) 或評論留言來描述問題,我們會盡快重新繪製並替換圖片。
|
||||
|
||||
### 2. 內容創作
|
||||
|
||||
如果您有興趣參與此開源專案,包括將程式碼翻譯成其他程式語言、擴展文章內容等,那麼需要實施以下 Pull Request 工作流程。
|
||||
|
||||
1. 登入 GitHub ,將本書的[程式碼倉庫](https://github.com/krahets/hello-algo) Fork 到個人帳號下。
|
||||
2. 進入您的 Fork 倉庫網頁,使用 `git clone` 命令將倉庫克隆至本地。
|
||||
3. 在本地進行內容創作,並進行完整測試,驗證程式碼的正確性。
|
||||
4. 將本地所做更改 Commit ,然後 Push 至遠端倉庫。
|
||||
5. 重新整理倉庫網頁,點選“Create pull request”按鈕即可發起拉取請求。
|
||||
|
||||
### 3. Docker 部署
|
||||
|
||||
在 `hello-algo` 根目錄下,執行以下 Docker 指令碼,即可在 `http://localhost:8000` 訪問本專案:
|
||||
|
||||
```shell
|
||||
docker-compose up -d
|
||||
```
|
||||
|
||||
使用以下命令即可刪除部署:
|
||||
|
||||
```shell
|
||||
docker-compose down
|
||||
```
|
||||
@@ -0,0 +1,14 @@
|
||||
---
|
||||
comments: true
|
||||
icon: material/help-circle-outline
|
||||
---
|
||||
|
||||
# 第 16 章 附錄
|
||||
|
||||
{ class="cover-image" }
|
||||
|
||||
## 本章內容
|
||||
|
||||
- [16.1 程式設計環境安裝](installation.md)
|
||||
- [16.2 一起參與創作](contribution.md)
|
||||
- [16.3 術語表](terminology.md)
|
||||
@@ -0,0 +1,76 @@
|
||||
---
|
||||
comments: true
|
||||
---
|
||||
|
||||
# 16.1 程式設計環境安裝
|
||||
|
||||
## 16.1.1 安裝 IDE
|
||||
|
||||
推薦使用開源、輕量的 VS Code 作為本地整合開發環境(IDE)。訪問 [VS Code 官網](https://code.visualstudio.com/),根據作業系統選擇相應版本的 VS Code 進行下載和安裝。
|
||||
|
||||
{ class="animation-figure" }
|
||||
|
||||
<p align="center"> 圖 16-1 從官網下載 VS Code </p>
|
||||
|
||||
VS Code 擁有強大的擴展包生態系統,支持大多數程式語言的執行和除錯。以 Python 為例,安裝“Python Extension Pack”擴展包之後,即可進行 Python 程式碼除錯。安裝步驟如圖 16-2 所示。
|
||||
|
||||
{ class="animation-figure" }
|
||||
|
||||
<p align="center"> 圖 16-2 安裝 VS Code 擴展包 </p>
|
||||
|
||||
## 16.1.2 安裝語言環境
|
||||
|
||||
### 1. 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. 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. Java 環境
|
||||
|
||||
1. 下載並安裝 [OpenJDK](https://jdk.java.net/18/)(版本需滿足 > JDK 9)。
|
||||
2. 在 VS Code 的擴充功能市場中搜索 `java` ,安裝 Extension Pack for Java 。
|
||||
|
||||
### 4. 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. Go 環境
|
||||
|
||||
1. 下載並安裝 [go](https://go.dev/dl/) 。
|
||||
2. 在 VS Code 的擴充功能市場中搜索 `go` ,安裝 Go 。
|
||||
3. 按快捷鍵 `Ctrl + Shift + P` 撥出命令欄,輸入 go ,選擇 `Go: Install/Update Tools` ,全部勾選並安裝即可。
|
||||
|
||||
### 6. 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. JavaScript 環境
|
||||
|
||||
1. 下載並安裝 [Node.js](https://nodejs.org/en/) 。
|
||||
2. (可選)在 VS Code 的擴充功能市場中搜索 `Prettier` ,安裝程式碼格式化工具。
|
||||
|
||||
### 8. TypeScript 環境
|
||||
|
||||
1. 同 JavaScript 環境安裝步驟。
|
||||
2. 安裝 [TypeScript Execute (tsx)](https://github.com/privatenumber/tsx?tab=readme-ov-file#global-installation) 。
|
||||
3. 在 VS Code 的擴充功能市場中搜索 `typescript` ,安裝 [Pretty TypeScript Errors](https://marketplace.visualstudio.com/items?itemName=yoavbls.pretty-ts-errors) 。
|
||||
|
||||
### 9. Dart 環境
|
||||
|
||||
1. 下載並安裝 [Dart](https://dart.dev/get-dart) 。
|
||||
2. 在 VS Code 的擴充功能市場中搜索 `dart` ,安裝 [Dart](https://marketplace.visualstudio.com/items?itemName=Dart-Code.dart-code) 。
|
||||
|
||||
### 10. 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) 。
|
||||
@@ -0,0 +1,142 @@
|
||||
---
|
||||
comments: true
|
||||
---
|
||||
|
||||
# 16.3 術語表
|
||||
|
||||
表 16-1 列出了書中出現的重要術語。建議記住各個名詞的英文叫法,以便閱讀英文文獻。
|
||||
|
||||
<p align="center"> 表 16-1 資料結構與演算法的重要名詞 </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$ 記號 |
|
||||
| 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 樹 |
|
||||
| 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$ 問題 |
|
||||
| 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$ 皇后問題 |
|
||||
| dynamic programming | 動態規劃 |
|
||||
| initial state | 初始狀態 |
|
||||
| state-transition equation | 狀態轉移方程 |
|
||||
| knapsack problem | 背包問題 |
|
||||
| edit distance problem | 編輯距離問題 |
|
||||
| greedy algorithm | 貪婪演算法 |
|
||||
|
||||
</div>
|
||||
Reference in New Issue
Block a user