Update README for zh-hant version (#1228)

* Bug fixes

* Fix the term in heap figures

* Unify the font of the chapter covers for the zh, en, and zh-Hant version

* Sync the zh-hant vertion with the main branch

* Update README for testing

* Update README for testing

* Update README for testing

* Update README for zh, en, zh-hant version

* Fix the issue links

* Update README

* Update README

* edition -> version
pull/1198/head
Yudong Jin 7 months ago committed by GitHub
parent 5f7385c8a3
commit 6e570e2863
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -4,7 +4,7 @@
</p>
<p align="center">
<img src="https://readme-typing-svg.demolab.com?font=Noto+Sans+SC&weight=500&duration=3500&pause=2000&color=21C8B8&center=true&vCenter=true&random=false&width=200&lines=Hello%2C+%E7%AE%97%E6%B3%95+!" alt="hello-algo-typing-svg" />
<img style="height: 60px;" src="https://readme-typing-svg.demolab.com?font=Noto+Sans+SC&weight=400&duration=3500&pause=2000&color=21C8B8&center=true&vCenter=true&random=false&width=200&lines=Hello%2C+%E7%AE%97%E6%B3%95+!" alt="hello-algo-typing-svg" />
</br>
动画图解、一键运行的数据结构与算法教程
</p>
@ -14,13 +14,11 @@
<img src="https://www.hello-algo.com/index.assets/btn_read_online_dark.svg" width="145"></a>
<a href="https://github.com/krahets/hello-algo/releases">
<img src="https://www.hello-algo.com/index.assets/btn_download_pdf_dark.svg" width="145"></a>
<a href="https://github.com/krahets/hello-algo/blob/main/en/README.md">
<img src="https://www.hello-algo.com/index.assets/btn_english_edition_dark.svg" width="145"></a>
</p>
<p align="center">
<img src="https://www.hello-algo.com/index.assets/animation.gif" width="396">
<img src="https://www.hello-algo.com/index.assets/running_code.gif" width="396">
<img src="https://www.hello-algo.com/index.assets/animation.gif" width="389">
<img src="https://www.hello-algo.com/index.assets/running_code.gif" width="389">
</p>
<p align="center">
@ -35,8 +33,20 @@
<img src="https://img.shields.io/badge/Dart-snow?logo=dart&logoColor=0175C2">
<img src="https://img.shields.io/badge/Rust-snow?logo=rust&logoColor=000000">
<img src="https://img.shields.io/badge/C-snow?logo=c&logoColor=A8B9CC">
<img src="https://img.shields.io/badge/Kotlin-snow?logo=kotlin&logoColor=7F52FF">
<img src="https://img.shields.io/badge/Zig-snow?logo=zig&logoColor=F7A41D">
<img src="https://img.shields.io/badge/Stay%20Tuned-snow">
</p>
<p align="center">
简体中文
<a href="https://github.com/krahets/hello-algo/blob/main/zh-hant/README.md">
繁體中文
</a>
<a href="https://github.com/krahets/hello-algo/blob/main/en/README.md">
English
</a>
</p>
## 关于本书

@ -106,7 +106,7 @@ def log_recur(n)
log_recur(n / 2) + 1
end
### 线性对数阶
### 线性对数阶 ###
def linear_log_recur(n)
return 1 unless n > 1

@ -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}"

Binary file not shown.

Before

Width:  |  Height:  |  Size: 113 KiB

After

Width:  |  Height:  |  Size: 114 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 125 KiB

After

Width:  |  Height:  |  Size: 126 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 126 KiB

After

Width:  |  Height:  |  Size: 127 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 94 KiB

After

Width:  |  Height:  |  Size: 94 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 142 KiB

After

Width:  |  Height:  |  Size: 143 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 100 KiB

After

Width:  |  Height:  |  Size: 100 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 164 KiB

After

Width:  |  Height:  |  Size: 164 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 84 KiB

After

Width:  |  Height:  |  Size: 84 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 135 KiB

After

Width:  |  Height:  |  Size: 136 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 137 KiB

After

Width:  |  Height:  |  Size: 137 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 109 KiB

After

Width:  |  Height:  |  Size: 109 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 136 KiB

After

Width:  |  Height:  |  Size: 136 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 118 KiB

After

Width:  |  Height:  |  Size: 119 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 128 KiB

After

Width:  |  Height:  |  Size: 129 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 91 KiB

After

Width:  |  Height:  |  Size: 91 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 103 KiB

After

Width:  |  Height:  |  Size: 103 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 118 KiB

After

Width:  |  Height:  |  Size: 118 KiB

@ -27,18 +27,18 @@
| big-$O$ notation | 大 $O$ 记号 | 大 $O$ 記號 |
| asymptotic upper bound | 渐近上界 | 漸近上界 |
| sign-magnitude | 原码 | 原碼 |
| 1s complement | 反码 | 反碼 |
| 2s complement | 补码 | 補碼 |
| 1s complement | 反码 | 一補數 |
| 2s 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 | 缓存命中率 | 快取命中率 |

@ -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..<n) {
function()
}
}
/* 递归 O(n) */
/* 递归的空间复杂度为 O(n) */
fun recur(n: Int) {
if (n == 1) return
return recur(n - 1)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 23 KiB

@ -4,7 +4,7 @@
</p>
<p align="center">
<img src="https://readme-typing-svg.demolab.com?font=Noto+Sans+SC&weight=500&duration=3500&pause=2000&color=21C8B8&center=true&vCenter=true&random=false&width=200&lines=Hello%2C+Algo+!" alt="hello-algo-typing-svg" />
<img style="height: 60px;" src="https://readme-typing-svg.demolab.com?font=Noto+Sans+SC&weight=500&duration=3500&pause=2000&color=21C8B8&center=true&vCenter=true&random=false&width=200&lines=Hello%2C+Algo+!" alt="hello-algo-typing-svg" />
</br>
Data Structures and Algorithms Crash Course with Animated Illustrations and Off-the-Shelf Code
</p>
@ -12,15 +12,11 @@
<p align="center">
<a href="https://www.hello-algo.com/en/">
<img src="https://www.hello-algo.com/en/index.assets/btn_read_online_dark.svg" width="120"></a>
<a href="https://github.com/krahets/hello-algo/releases">
<img src="https://www.hello-algo.com/en/index.assets/btn_download_pdf_dark.svg" width="120"></a>
<a href="https://github.com/krahets/hello-algo">
<img src="https://www.hello-algo.com/en/index.assets/btn_chinese_edition_dark.svg" width="120"></a>
</p>
<p align="center">
<img src="https://www.hello-algo.com/en/index.assets/animation.gif" width="396">
<img src="https://www.hello-algo.com/en/index.assets/running_code.gif" width="396">
<img src="https://www.hello-algo.com/en/index.assets/animation.gif" width="389">
<img src="https://www.hello-algo.com/en/index.assets/running_code.gif" width="389">
</p>
<p align="center">
@ -35,13 +31,21 @@
<img src="https://img.shields.io/badge/Dart-snow?logo=dart&logoColor=0175C2">
<img src="https://img.shields.io/badge/Rust-snow?logo=rust&logoColor=000000">
<img src="https://img.shields.io/badge/C-snow?logo=c&logoColor=A8B9CC">
<img src="https://img.shields.io/badge/Kotlin-snow?logo=kotlin&logoColor=7F52FF">
<img src="https://img.shields.io/badge/Zig-snow?logo=zig&logoColor=F7A41D">
<img src="https://img.shields.io/badge/Stay%20Tuned-snow">
</p>
> [!Important]
>
> We are working on Chinese-to-English translation. For more information please see [#914](https://github.com/krahets/hello-algo/issues/914).
<p align="center">
<a href="https://github.com/krahets/hello-algo">
简体中文
</a>
<a href="https://github.com/krahets/hello-algo/blob/main/zh-hant/README.md">
繁體中文
</a>
English
</p>
## 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.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 114 KiB

After

Width:  |  Height:  |  Size: 114 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 126 KiB

After

Width:  |  Height:  |  Size: 125 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 128 KiB

After

Width:  |  Height:  |  Size: 127 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 96 KiB

After

Width:  |  Height:  |  Size: 95 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 142 KiB

After

Width:  |  Height:  |  Size: 142 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 104 KiB

After

Width:  |  Height:  |  Size: 103 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 164 KiB

After

Width:  |  Height:  |  Size: 163 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 84 KiB

After

Width:  |  Height:  |  Size: 84 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 136 KiB

After

Width:  |  Height:  |  Size: 136 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 137 KiB

After

Width:  |  Height:  |  Size: 136 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 110 KiB

After

Width:  |  Height:  |  Size: 110 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 142 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 138 KiB

After

Width:  |  Height:  |  Size: 136 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 119 KiB

After

Width:  |  Height:  |  Size: 119 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 128 KiB

After

Width:  |  Height:  |  Size: 129 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 91 KiB

After

Width:  |  Height:  |  Size: 91 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 104 KiB

After

Width:  |  Height:  |  Size: 104 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 118 KiB

After

Width:  |  Height:  |  Size: 118 KiB

@ -45,7 +45,7 @@ hide:
</p>
<div class="admonition example" style="max-width: 800px;margin: 0 auto;">
<p class="admonition-title">The English edition is brewing...</p>
<p class="admonition-title">The English version is brewing...</p>
<p>Feel free to engage in Chinese-to-English translation and pull request review! For guidelines, please see <a href="https://github.com/krahets/hello-algo/issues/914">#914</a>.</p>
</div>

@ -3,8 +3,10 @@
{% block announce %}
{% if config.theme.language == 'zh' %}
{% set announcements = '纸质书已发布,详情请见<a href="/chapter_paperbook/">这里</a>' %}
{% if config.theme.language == 'zh-Hant' %}
{% set announcements = '紙質書(簡體中文版)已發行,詳情請見<a href="/chapter_paperbook/">這裡</a>' %}
{% elif config.theme.language == 'en' %}
{% set announcements = 'The paper book (Chinese edition) published. Please visit <a href="/chapter_paperbook/">this link</a> for more details.' %}
{% set announcements = 'The paper book (Chinese version) published. Please visit <a href="/chapter_paperbook/">this link</a> for more details.' %}
{% endif %}
<div class="banner-svg">
<svg xmlns="http://www.w3.org/2000/svg"

@ -4,23 +4,19 @@
</p>
<p align="center">
<img src="https://readme-typing-svg.demolab.com?font=Noto+Sans+SC&weight=500&duration=3500&pause=2000&color=21C8B8&center=true&vCenter=true&random=false&width=200&lines=Hello%2C+%E7%AE%97%E6%B3%95+!" alt="hello-algo-typing-svg" />
<img style="height: 60px;" src="https://readme-typing-svg.demolab.com/?font=Noto+Sans+SC&weight=400&duration=3500&pause=2000&color=21C8B8&center=true&vCenter=true&random=false&width=200&lines=Hello%2C+%E6%BC%94%E7%AE%97%E6%B3%95+!" alt="hello-algo-typing-svg" />
</br>
動畫圖解、一鍵執行的資料結構與演算法教程
</p>
<p align="center">
<a href="https://www.hello-algo.com/">
<img src="https://www.hello-algo.com/index.assets/btn_read_online_dark.svg" width="145"></a>
<a href="https://github.com/krahets/hello-algo/releases">
<img src="https://www.hello-algo.com/index.assets/btn_download_pdf_dark.svg" width="145"></a>
<a href="https://github.com/krahets/hello-algo/blob/main/en/README.md">
<img src="https://www.hello-algo.com/index.assets/btn_english_edition_dark.svg" width="145"></a>
<a href="https://www.hello-algo.com/zh-hant/">
<img src="https://www.hello-algo.com/zh-hant/index.assets/btn_read_online_dark.svg" width="145"></a>
</p>
<p align="center">
<img src="https://www.hello-algo.com/index.assets/animation.gif" width="396">
<img src="https://www.hello-algo.com/index.assets/running_code.gif" width="396">
<img src="https://www.hello-algo.com/index.assets/animation.gif" width="389">
<img src="https://www.hello-algo.com/index.assets/running_code.gif" width="389">
</p>
<p align="center">
@ -35,8 +31,20 @@
<img src="https://img.shields.io/badge/Dart-snow?logo=dart&logoColor=0175C2">
<img src="https://img.shields.io/badge/Rust-snow?logo=rust&logoColor=000000">
<img src="https://img.shields.io/badge/C-snow?logo=c&logoColor=A8B9CC">
<img src="https://img.shields.io/badge/Kotlin-snow?logo=kotlin&logoColor=7F52FF">
<img src="https://img.shields.io/badge/Zig-snow?logo=zig&logoColor=F7A41D">
<img src="https://img.shields.io/badge/Stay%20Tuned-snow">
</p>
<p align="center">
<a href="https://github.com/krahets/hello-algo">
简体中文
</a>
繁體中文
<a href="https://github.com/krahets/hello-algo/blob/main/en/README.md">
English
</a>
</p>
## 關於本書
@ -61,6 +69,10 @@
## 貢獻
> [!Important]
>
> 歡迎您於 [#1171](https://github.com/krahets/hello-algo/issues/1171) 為繁體中文版勘誤。
本開源書仍在持續更新之中,歡迎您參與本專案,一同為讀者提供更優質的學習內容。
- [內容修正](https://www.hello-algo.com/chapter_appendix/contribution/):請您協助修正或在評論區指出語法錯誤、內容缺失、文字歧義、無效連結或程式碼 bug 等問題。

@ -106,7 +106,7 @@ def log_recur(n)
log_recur(n / 2) + 1
end
### 線性對數階
### 線性對數階 ###
def linear_log_recur(n)
return 1 unless n > 1

@ -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}"

@ -27,18 +27,18 @@
| big-$O$ notation | 大 $O$ 记号 | 大 $O$ 記號 |
| asymptotic upper bound | 渐近上界 | 漸近上界 |
| sign-magnitude | 原码 | 原碼 |
| 1s complement | 反码 | 反碼 |
| 2s complement | 补码 | 補碼 |
| 1s complement | 反码 | 一補數 |
| 2s 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 | 缓存命中率 | 快取命中率 |
@ -106,7 +106,7 @@
| adjacency list | 邻接表 | 鄰接表 |
| breadth-first search | 广度优先搜索 | 廣度優先搜尋 |
| depth-first search | 深度优先搜索 | 深度優先搜尋 |
| binary search | 二分查找 | 二分查找 |
| binary search | 二分查找 | 二分搜尋 |
| searching algorithm | 搜索算法 | 搜尋演算法 |
| sorting algorithm | 排序算法 | 排序演算法 |
| selection sort | 选择排序 | 選擇排序 |
@ -130,7 +130,7 @@
| $n$-queens problem | $n$ 皇后问题 | $n$ 皇后問題 |
| dynamic programming | 动态规划 | 動態規劃 |
| initial state | 初始状态 | 初始狀態 |
| state-trasition equation | 状态转移方程 | 狀態轉移方程 |
| state-transition equation | 状态转移方程 | 狀態轉移方程 |
| knapsack problem | 背包问题 | 背包問題 |
| edit distance problem | 编辑距离问题 | 編輯距離問題 |
| greedy algorithm | 贪心算法 | 貪婪演算法 |

@ -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..<n) {
function()
}
}
/* 遞迴 O(n) */
/* 遞迴的空間複雜度為 O(n) */
fun recur(n: Int) {
if (n == 1) return
return recur(n - 1)

@ -743,7 +743,7 @@ $$
$T(n)$ 是一次函式,說明其執行時間的增長趨勢是線性的,因此它的時間複雜度是線性階。
我們將線性階的時間複雜度記為 $O(n)$ ,這個數學符號稱為<u>$O$ 記號 big-$O$ notation</u>,表示函式 $T(n)$ 的<u>漸近上界asymptotic upper bound</u>
我們將線性階的時間複雜度記為 $O(n)$ ,這個數學符號稱為<u> $O$ 記號(big-$O$ notation</u>,表示函式 $T(n)$ 的<u>漸近上界asymptotic upper bound</u>
時間複雜度分析本質上是計算“操作數量 $T(n)$”的漸近上界,它具有明確的數學定義。

Loading…
Cancel
Save