diff --git a/README.md b/README.md index 758c260b7..3d4a94746 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@

- hello-algo-typing-svg + hello-algo-typing-svg
动画图解、一键运行的数据结构与算法教程

@@ -14,13 +14,11 @@ - -

- - + +

@@ -35,8 +33,20 @@ + - +

+ +

+ 简体中文 + | + + 繁體中文 + + | + + English +

## 关于本书 diff --git a/codes/ruby/chapter_computational_complexity/time_complexity.rb b/codes/ruby/chapter_computational_complexity/time_complexity.rb index 49bd8dc86..4af0759fc 100644 --- a/codes/ruby/chapter_computational_complexity/time_complexity.rb +++ b/codes/ruby/chapter_computational_complexity/time_complexity.rb @@ -106,7 +106,7 @@ def log_recur(n) log_recur(n / 2) + 1 end -### 线性对数阶 +### 线性对数阶 ### def linear_log_recur(n) return 1 unless n > 1 diff --git a/codes/ruby/chapter_computational_complexity/worst_best_time_complexity.rb b/codes/ruby/chapter_computational_complexity/worst_best_time_complexity.rb index 4610c4012..4c0cd4776 100644 --- a/codes/ruby/chapter_computational_complexity/worst_best_time_complexity.rb +++ b/codes/ruby/chapter_computational_complexity/worst_best_time_complexity.rb @@ -5,7 +5,7 @@ Author: Xuan Khoa Tu Nguyen (ngxktuzkai2000@gmail.com) =end ### 生成一个数组,元素为: 1, 2, ..., n ,顺序被打乱 ### -def random_number(n) +def random_numbers(n) # 生成数组 nums =: 1, 2, 3, ..., n nums = Array.new(n) { |i| i + 1 } # 随机打乱数组元素 @@ -27,7 +27,7 @@ end for i in 0...10 n = 100 - nums = random_number(n) + nums = random_numbers(n) index = find_one(nums) puts "\n数组 [ 1, 2, ..., n ] 被打乱后 = #{nums}" puts "数字 1 的索引为 #{index}" diff --git a/docs/assets/covers/chapter_appendix.jpg b/docs/assets/covers/chapter_appendix.jpg index f455b97ca..f88d5ccc7 100644 Binary files a/docs/assets/covers/chapter_appendix.jpg and b/docs/assets/covers/chapter_appendix.jpg differ diff --git a/docs/assets/covers/chapter_array_and_linkedlist.jpg b/docs/assets/covers/chapter_array_and_linkedlist.jpg index c033f7c92..624f21b3b 100644 Binary files a/docs/assets/covers/chapter_array_and_linkedlist.jpg and b/docs/assets/covers/chapter_array_and_linkedlist.jpg differ diff --git a/docs/assets/covers/chapter_backtracking.jpg b/docs/assets/covers/chapter_backtracking.jpg index b5ee69c89..bfc268768 100644 Binary files a/docs/assets/covers/chapter_backtracking.jpg and b/docs/assets/covers/chapter_backtracking.jpg differ diff --git a/docs/assets/covers/chapter_complexity_analysis.jpg b/docs/assets/covers/chapter_complexity_analysis.jpg index be3d1cc43..67e75e007 100644 Binary files a/docs/assets/covers/chapter_complexity_analysis.jpg and b/docs/assets/covers/chapter_complexity_analysis.jpg differ diff --git a/docs/assets/covers/chapter_data_structure.jpg b/docs/assets/covers/chapter_data_structure.jpg index 45a0d0e7c..61892bd51 100644 Binary files a/docs/assets/covers/chapter_data_structure.jpg and b/docs/assets/covers/chapter_data_structure.jpg differ diff --git a/docs/assets/covers/chapter_divide_and_conquer.jpg b/docs/assets/covers/chapter_divide_and_conquer.jpg index 1336e171d..96613abe1 100644 Binary files a/docs/assets/covers/chapter_divide_and_conquer.jpg and b/docs/assets/covers/chapter_divide_and_conquer.jpg differ diff --git a/docs/assets/covers/chapter_dynamic_programming.jpg b/docs/assets/covers/chapter_dynamic_programming.jpg index 376a8900c..416f3b447 100644 Binary files a/docs/assets/covers/chapter_dynamic_programming.jpg and b/docs/assets/covers/chapter_dynamic_programming.jpg differ diff --git a/docs/assets/covers/chapter_graph.jpg b/docs/assets/covers/chapter_graph.jpg index 368fce371..e02c1a589 100644 Binary files a/docs/assets/covers/chapter_graph.jpg and b/docs/assets/covers/chapter_graph.jpg differ diff --git a/docs/assets/covers/chapter_greedy.jpg b/docs/assets/covers/chapter_greedy.jpg index a64651745..09bba4d2a 100644 Binary files a/docs/assets/covers/chapter_greedy.jpg and b/docs/assets/covers/chapter_greedy.jpg differ diff --git a/docs/assets/covers/chapter_hashing.jpg b/docs/assets/covers/chapter_hashing.jpg index 74fdf9a6d..7289be32e 100644 Binary files a/docs/assets/covers/chapter_hashing.jpg and b/docs/assets/covers/chapter_hashing.jpg differ diff --git a/docs/assets/covers/chapter_heap.jpg b/docs/assets/covers/chapter_heap.jpg index 829bfbe11..63630beef 100644 Binary files a/docs/assets/covers/chapter_heap.jpg and b/docs/assets/covers/chapter_heap.jpg differ diff --git a/docs/assets/covers/chapter_introduction.jpg b/docs/assets/covers/chapter_introduction.jpg index 5b80c7ee6..73356b886 100644 Binary files a/docs/assets/covers/chapter_introduction.jpg and b/docs/assets/covers/chapter_introduction.jpg differ diff --git a/docs/assets/covers/chapter_preface.jpg b/docs/assets/covers/chapter_preface.jpg index 4e295e015..8414897ad 100644 Binary files a/docs/assets/covers/chapter_preface.jpg and b/docs/assets/covers/chapter_preface.jpg differ diff --git a/docs/assets/covers/chapter_searching.jpg b/docs/assets/covers/chapter_searching.jpg index 8dce9d89e..0a5226111 100644 Binary files a/docs/assets/covers/chapter_searching.jpg and b/docs/assets/covers/chapter_searching.jpg differ diff --git a/docs/assets/covers/chapter_sorting.jpg b/docs/assets/covers/chapter_sorting.jpg index 2e8023ecd..63b252e76 100644 Binary files a/docs/assets/covers/chapter_sorting.jpg and b/docs/assets/covers/chapter_sorting.jpg differ diff --git a/docs/assets/covers/chapter_stack_and_queue.jpg b/docs/assets/covers/chapter_stack_and_queue.jpg index 6642497b7..e8cd51bfc 100644 Binary files a/docs/assets/covers/chapter_stack_and_queue.jpg and b/docs/assets/covers/chapter_stack_and_queue.jpg differ diff --git a/docs/assets/covers/chapter_tree.jpg b/docs/assets/covers/chapter_tree.jpg index 56c7b1491..7d472d3fc 100644 Binary files a/docs/assets/covers/chapter_tree.jpg and b/docs/assets/covers/chapter_tree.jpg differ diff --git a/docs/chapter_appendix/terminology.md b/docs/chapter_appendix/terminology.md index 56a1bcfd5..3283ac21b 100644 --- a/docs/chapter_appendix/terminology.md +++ b/docs/chapter_appendix/terminology.md @@ -27,18 +27,18 @@ | big-$O$ notation | 大 $O$ 记号 | 大 $O$ 記號 | | asymptotic upper bound | 渐近上界 | 漸近上界 | | sign-magnitude | 原码 | 原碼 | -| 1’s complement | 反码 | 反碼 | -| 2’s complement | 补码 | 補碼 | +| 1’s complement | 反码 | 一補數 | +| 2’s complement | 补码 | 二補數 | | array | 数组 | 陣列 | | index | 索引 | 索引 | | linked list | 链表 | 鏈結串列 | | linked list node, list node | 链表节点 | 鏈結串列節點 | | head node | 头节点 | 頭節點 | | tail node | 尾节点 | 尾節點 | -| list | 列表 | 列表 | +| list | 列表 | 串列 | | dynamic array | 动态数组 | 動態陣列 | | hard disk | 硬盘 | 硬碟 | -| random-access memory (RAM) | 内存 | 內存 | +| random-access memory (RAM) | 内存 | 記憶體 | | cache memory | 缓存 | 快取 | | cache miss | 缓存未命中 | 快取未命中 | | cache hit rate | 缓存命中率 | 快取命中率 | diff --git a/docs/chapter_computational_complexity/space_complexity.md b/docs/chapter_computational_complexity/space_complexity.md index 7ccf2cda5..e6909ae8d 100755 --- a/docs/chapter_computational_complexity/space_complexity.md +++ b/docs/chapter_computational_complexity/space_complexity.md @@ -563,13 +563,13 @@ // 执行某些操作 return 0; } - /* 循环 O(1) */ + /* 循环的空间复杂度为 O(1) */ void loop(int n) { for (int i = 0; i < n; i++) { func(); } } - /* 递归 O(n) */ + /* 递归的空间复杂度为 O(n) */ void recur(int n) { if (n == 1) return; return recur(n - 1); @@ -583,13 +583,13 @@ // 执行某些操作 return 0; } - /* 循环 O(1) */ + /* 循环的空间复杂度为 O(1) */ void loop(int n) { for (int i = 0; i < n; i++) { function(); } } - /* 递归 O(n) */ + /* 递归的空间复杂度为 O(n) */ void recur(int n) { if (n == 1) return; return recur(n - 1); @@ -603,13 +603,13 @@ // 执行某些操作 return 0; } - /* 循环 O(1) */ + /* 循环的空间复杂度为 O(1) */ void Loop(int n) { for (int i = 0; i < n; i++) { Function(); } } - /* 递归 O(n) */ + /* 递归的空间复杂度为 O(n) */ int Recur(int n) { if (n == 1) return 1; return Recur(n - 1); @@ -624,14 +624,14 @@ return 0 } - /* 循环 O(1) */ + /* 循环的空间复杂度为 O(1) */ func loop(n int) { for i := 0; i < n; i++ { function() } } - /* 递归 O(n) */ + /* 递归的空间复杂度为 O(n) */ func recur(n int) { if n == 1 { return @@ -649,14 +649,14 @@ return 0 } - /* 循环 O(1) */ + /* 循环的空间复杂度为 O(1) */ func loop(n: Int) { for _ in 0 ..< n { function() } } - /* 递归 O(n) */ + /* 递归的空间复杂度为 O(n) */ func recur(n: Int) { if n == 1 { return @@ -672,13 +672,13 @@ // 执行某些操作 return 0; } - /* 循环 O(1) */ + /* 循环的空间复杂度为 O(1) */ function loop(n) { for (let i = 0; i < n; i++) { constFunc(); } } - /* 递归 O(n) */ + /* 递归的空间复杂度为 O(n) */ function recur(n) { if (n === 1) return; return recur(n - 1); @@ -692,13 +692,13 @@ // 执行某些操作 return 0; } - /* 循环 O(1) */ + /* 循环的空间复杂度为 O(1) */ function loop(n: number): void { for (let i = 0; i < n; i++) { constFunc(); } } - /* 递归 O(n) */ + /* 递归的空间复杂度为 O(n) */ function recur(n: number): void { if (n === 1) return; return recur(n - 1); @@ -712,13 +712,13 @@ // 执行某些操作 return 0; } - /* 循环 O(1) */ + /* 循环的空间复杂度为 O(1) */ void loop(int n) { for (int i = 0; i < n; i++) { function(); } } - /* 递归 O(n) */ + /* 递归的空间复杂度为 O(n) */ void recur(int n) { if (n == 1) return; return recur(n - 1); @@ -732,13 +732,13 @@ // 执行某些操作 return 0; } - /* 循环 O(1) */ + /* 循环的空间复杂度为 O(1) */ fn loop(n: i32) { for i in 0..n { function(); } } - /* 递归 O(n) */ + /* 递归的空间复杂度为 O(n) */ fn recur(n: i32) { if n == 1 { return; @@ -754,13 +754,13 @@ // 执行某些操作 return 0; } - /* 循环 O(1) */ + /* 循环的空间复杂度为 O(1) */ void loop(int n) { for (int i = 0; i < n; i++) { func(); } } - /* 递归 O(n) */ + /* 递归的空间复杂度为 O(n) */ void recur(int n) { if (n == 1) return; return recur(n - 1); @@ -774,13 +774,13 @@ // 执行某些操作 return 0 } - /* 循环 O(1) */ + /* 循环的空间复杂度为 O(1) */ fun loop(n: Int) { for (i in 0..大$O$ 记号(big-$O$ notation),表示函数 $T(n)$ 的渐近上界(asymptotic upper bound)。 +我们将线性阶的时间复杂度记为 $O(n)$ ,这个数学符号称为大 $O$ 记号(big-$O$ notation),表示函数 $T(n)$ 的渐近上界(asymptotic upper bound)。 时间复杂度分析本质上是计算“操作数量 $T(n)$”的渐近上界,它具有明确的数学定义。 diff --git a/docs/chapter_heap/heap.assets/heap_pop_step10.png b/docs/chapter_heap/heap.assets/heap_pop_step10.png index d831efbf9..450ad9b8f 100644 Binary files a/docs/chapter_heap/heap.assets/heap_pop_step10.png and b/docs/chapter_heap/heap.assets/heap_pop_step10.png differ diff --git a/docs/chapter_heap/heap.assets/heap_push_step9.png b/docs/chapter_heap/heap.assets/heap_push_step9.png index 8f26a52ca..14d20ceaf 100644 Binary files a/docs/chapter_heap/heap.assets/heap_push_step9.png and b/docs/chapter_heap/heap.assets/heap_push_step9.png differ diff --git a/en/README.md b/en/README.md index 1e7e7e42c..b59f42191 100644 --- a/en/README.md +++ b/en/README.md @@ -4,7 +4,7 @@

- hello-algo-typing-svg + hello-algo-typing-svg
Data Structures and Algorithms Crash Course with Animated Illustrations and Off-the-Shelf Code

@@ -12,15 +12,11 @@

- - - -

- - + +

@@ -35,13 +31,21 @@ + -

-> [!Important] -> -> We are working on Chinese-to-English translation. For more information please see [#914](https://github.com/krahets/hello-algo/issues/914). +

+ + 简体中文 + + | + + 繁體中文 + + | + English +

## About @@ -65,6 +69,10 @@ If you find this book helpful, please give it a Star :star: to support us, thank ## Contribution +> [!Important] +> +> We are working on Chinese-to-English translation. For more information please see [#914](https://github.com/krahets/hello-algo/issues/914). + This open-source book is continuously being updated, and we welcome your participation in this project to provide better learning content for readers. - [Content Correction](https://www.hello-algo.com/en/chapter_appendix/contribution/): Please help us correct or point out mistakes in the comments section such as grammatical errors, missing content, ambiguities, invalid links, or code bugs. diff --git a/en/docs/assets/covers/chapter_appendix.jpg b/en/docs/assets/covers/chapter_appendix.jpg index a1399ac94..00a849b57 100644 Binary files a/en/docs/assets/covers/chapter_appendix.jpg and b/en/docs/assets/covers/chapter_appendix.jpg differ diff --git a/en/docs/assets/covers/chapter_array_and_linkedlist.jpg b/en/docs/assets/covers/chapter_array_and_linkedlist.jpg index d6997a55d..d5092e897 100644 Binary files a/en/docs/assets/covers/chapter_array_and_linkedlist.jpg and b/en/docs/assets/covers/chapter_array_and_linkedlist.jpg differ diff --git a/en/docs/assets/covers/chapter_backtracking.jpg b/en/docs/assets/covers/chapter_backtracking.jpg index d2d5f90a3..1c91c7818 100644 Binary files a/en/docs/assets/covers/chapter_backtracking.jpg and b/en/docs/assets/covers/chapter_backtracking.jpg differ diff --git a/en/docs/assets/covers/chapter_complexity_analysis.jpg b/en/docs/assets/covers/chapter_complexity_analysis.jpg index 04b079cf4..2a19ed360 100644 Binary files a/en/docs/assets/covers/chapter_complexity_analysis.jpg and b/en/docs/assets/covers/chapter_complexity_analysis.jpg differ diff --git a/en/docs/assets/covers/chapter_data_structure.jpg b/en/docs/assets/covers/chapter_data_structure.jpg index 22f1e6770..590a6edaa 100644 Binary files a/en/docs/assets/covers/chapter_data_structure.jpg and b/en/docs/assets/covers/chapter_data_structure.jpg differ diff --git a/en/docs/assets/covers/chapter_divide_and_conquer.jpg b/en/docs/assets/covers/chapter_divide_and_conquer.jpg index 4171446ad..8ad3560d1 100644 Binary files a/en/docs/assets/covers/chapter_divide_and_conquer.jpg and b/en/docs/assets/covers/chapter_divide_and_conquer.jpg differ diff --git a/en/docs/assets/covers/chapter_dynamic_programming.jpg b/en/docs/assets/covers/chapter_dynamic_programming.jpg index b64eece5c..5b5a6ec21 100644 Binary files a/en/docs/assets/covers/chapter_dynamic_programming.jpg and b/en/docs/assets/covers/chapter_dynamic_programming.jpg differ diff --git a/en/docs/assets/covers/chapter_graph.jpg b/en/docs/assets/covers/chapter_graph.jpg index c3daa59ad..bec81a2e1 100644 Binary files a/en/docs/assets/covers/chapter_graph.jpg and b/en/docs/assets/covers/chapter_graph.jpg differ diff --git a/en/docs/assets/covers/chapter_greedy.jpg b/en/docs/assets/covers/chapter_greedy.jpg index ed8a68214..6905df2d4 100644 Binary files a/en/docs/assets/covers/chapter_greedy.jpg and b/en/docs/assets/covers/chapter_greedy.jpg differ diff --git a/en/docs/assets/covers/chapter_hashing.jpg b/en/docs/assets/covers/chapter_hashing.jpg index e74403232..b41dbbead 100644 Binary files a/en/docs/assets/covers/chapter_hashing.jpg and b/en/docs/assets/covers/chapter_hashing.jpg differ diff --git a/en/docs/assets/covers/chapter_heap.jpg b/en/docs/assets/covers/chapter_heap.jpg index b603826a3..54fe1d4fa 100644 Binary files a/en/docs/assets/covers/chapter_heap.jpg and b/en/docs/assets/covers/chapter_heap.jpg differ diff --git a/en/docs/assets/covers/chapter_hello_algo.jpg b/en/docs/assets/covers/chapter_hello_algo.jpg new file mode 100644 index 000000000..8e347b3a4 Binary files /dev/null and b/en/docs/assets/covers/chapter_hello_algo.jpg differ diff --git a/en/docs/assets/covers/chapter_introduction.jpg b/en/docs/assets/covers/chapter_introduction.jpg index 47e448f33..49e2c2a41 100644 Binary files a/en/docs/assets/covers/chapter_introduction.jpg and b/en/docs/assets/covers/chapter_introduction.jpg differ diff --git a/en/docs/assets/covers/chapter_preface.jpg b/en/docs/assets/covers/chapter_preface.jpg index 2ba0de189..d4dd753bd 100644 Binary files a/en/docs/assets/covers/chapter_preface.jpg and b/en/docs/assets/covers/chapter_preface.jpg differ diff --git a/en/docs/assets/covers/chapter_searching.jpg b/en/docs/assets/covers/chapter_searching.jpg index c6f50f15d..f5d9c2a19 100644 Binary files a/en/docs/assets/covers/chapter_searching.jpg and b/en/docs/assets/covers/chapter_searching.jpg differ diff --git a/en/docs/assets/covers/chapter_sorting.jpg b/en/docs/assets/covers/chapter_sorting.jpg index 0f441e9c3..f77e7050a 100644 Binary files a/en/docs/assets/covers/chapter_sorting.jpg and b/en/docs/assets/covers/chapter_sorting.jpg differ diff --git a/en/docs/assets/covers/chapter_stack_and_queue.jpg b/en/docs/assets/covers/chapter_stack_and_queue.jpg index ccfd8b330..8c75e4aae 100644 Binary files a/en/docs/assets/covers/chapter_stack_and_queue.jpg and b/en/docs/assets/covers/chapter_stack_and_queue.jpg differ diff --git a/en/docs/assets/covers/chapter_tree.jpg b/en/docs/assets/covers/chapter_tree.jpg index 50f449614..8d0001f02 100644 Binary files a/en/docs/assets/covers/chapter_tree.jpg and b/en/docs/assets/covers/chapter_tree.jpg differ diff --git a/en/docs/index.md b/en/docs/index.md index 9c8b01bed..d1195ac22 100644 --- a/en/docs/index.md +++ b/en/docs/index.md @@ -45,7 +45,7 @@ hide:

-

The English edition is brewing...

+

The English version is brewing...

Feel free to engage in Chinese-to-English translation and pull request review! For guidelines, please see #914.

diff --git a/overrides/main.html b/overrides/main.html index 1ea83977a..11b29f64c 100644 --- a/overrides/main.html +++ b/overrides/main.html @@ -3,8 +3,10 @@ {% block announce %} {% if config.theme.language == 'zh' %} {% set announcements = '纸质书已发布,详情请见这里' %} +{% if config.theme.language == 'zh-Hant' %} + {% set announcements = '紙質書(簡體中文版)已發行,詳情請見這裡' %} {% elif config.theme.language == 'en' %} - {% set announcements = 'The paper book (Chinese edition) published. Please visit this link for more details.' %} + {% set announcements = 'The paper book (Chinese version) published. Please visit this link for more details.' %} {% endif %}