mirror of
https://github.com/krahets/hello-algo.git
synced 2026-03-31 09:14:00 +08:00
Bug fixes and improvements (#1205)
* Add Ruby code blocks to documents * Remove Ruby code from en/docs * Remove "center-table" class in index.md * Add "data-toc-label" to handle the latex heading during the build process * Use normal JD link instead. * Bug fixes
This commit is contained in:
@@ -790,7 +790,7 @@ $$
|
||||
|
||||

|
||||
|
||||
### 常数阶 $O(1)$ {data-toc-label="常数阶"}
|
||||
### 常数阶 $O(1)$
|
||||
|
||||
常数阶常见于数量与输入数据大小 $n$ 无关的常量、变量、对象。
|
||||
|
||||
@@ -800,7 +800,7 @@ $$
|
||||
[file]{space_complexity}-[class]{}-[func]{constant}
|
||||
```
|
||||
|
||||
### 线性阶 $O(n)$ {data-toc-label="线性阶"}
|
||||
### 线性阶 $O(n)$
|
||||
|
||||
线性阶常见于元素数量与 $n$ 成正比的数组、链表、栈、队列等:
|
||||
|
||||
@@ -816,7 +816,7 @@ $$
|
||||
|
||||

|
||||
|
||||
### 平方阶 $O(n^2)$ {data-toc-label="平方阶"}
|
||||
### 平方阶 $O(n^2)$
|
||||
|
||||
平方阶常见于矩阵和图,元素数量与 $n$ 成平方关系:
|
||||
|
||||
@@ -832,7 +832,7 @@ $$
|
||||
|
||||

|
||||
|
||||
### 指数阶 $O(2^n)$ {data-toc-label="指数阶"}
|
||||
### 指数阶 $O(2^n)$
|
||||
|
||||
指数阶常见于二叉树。观察下图,层数为 $n$ 的“满二叉树”的节点数量为 $2^n - 1$ ,占用 $O(2^n)$ 空间:
|
||||
|
||||
@@ -842,7 +842,7 @@ $$
|
||||
|
||||

|
||||
|
||||
### 对数阶 $O(\log n)$ {data-toc-label="对数阶"}
|
||||
### 对数阶 $O(\log n)$
|
||||
|
||||
对数阶常见于分治算法。例如归并排序,输入长度为 $n$ 的数组,每轮递归将数组从中点处划分为两半,形成高度为 $\log n$ 的递归树,使用 $O(\log n)$ 栈帧空间。
|
||||
|
||||
|
||||
Reference in New Issue
Block a user