Fix some codes and a figure.

This commit is contained in:
krahets
2023-06-05 01:03:39 +08:00
parent 2532f06c7f
commit 698c2e7fe5
8 changed files with 48 additions and 46 deletions

View File

@ -592,7 +592,7 @@ $T(n)$ 是一次函数,说明时间增长趋势是线性的,因此可以得
根据定义,确定 $f(n)$ 之后,我们便可得到时间复杂度 $O(f(n))$ 。那么如何确定渐近上界 $f(n)$ 呢?总体分为两步:首先统计操作数量,然后判断渐近上界。
### 1) 统计操作数量
### 第一步:统计操作数量
针对代码,逐行从上到下计算即可。然而,由于上述 $c \cdot f(n)$ 中的常数项 $c$ 可以取任意大小,**因此操作数量 $T(n)$ 中的各种系数、常数项都可以被忽略**。根据此原则,可以总结出以下计数简化技巧:
@ -808,7 +808,7 @@ $$
}
```
### 2) 判断渐近上界
### 第二步:判断渐近上界
**时间复杂度由多项式 $T(n)$ 中最高阶的项来决定**。这是因为在 $n$ 趋于无穷大时,最高阶的项将发挥主导作用,其他项的影响都可以被忽略。

Binary file not shown.

Before

Width:  |  Height:  |  Size: 63 KiB

After

Width:  |  Height:  |  Size: 61 KiB