Skip to content

Commit

Permalink
📄 docs: 数据结构
Browse files Browse the repository at this point in the history
  • Loading branch information
yanxin152133 committed Sep 23, 2024
1 parent 9926d59 commit 6cfe4ad
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 0 deletions.
1 change: 1 addition & 0 deletions docs/_sidebar.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
* [Java](notes/Java/README.md)
* [node.js](notes/node/README.md)
* [python](notes/python/README.md)
- [参考资料](https://liujiangblog.com/course/python/1)
- [搭建环境](notes/python/搭建环境.md)
- [pip](notes/python/pip.md)
- [Python解释器](notes/python/Python解释器.md)
Expand Down
1 change: 1 addition & 0 deletions docs/notes/python/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# 1. python
- [参考资料](https://liujiangblog.com/course/python/1)
- [搭建环境](notes/python/搭建环境.md)
- [pip](notes/python/pip.md)
- [Python解释器](notes/python/Python解释器.md)
Expand Down
Binary file added docs/notes/数据结构/基础知识/image-8.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
34 changes: 34 additions & 0 deletions docs/notes/数据结构/基础知识/基础知识.md
Original file line number Diff line number Diff line change
Expand Up @@ -232,4 +232,38 @@ heap.poll(); // -> 8
- 搜索算法: N 代表搜索范围的元素总数,例如数组大小、矩阵大小、二叉树节点数、图节点和边数等;

### 1.2.1. 时间复杂度
>根据定义,时间复杂度指输入数据大小为N时,算法运行所需花费的时间。
注意事项:
- 统计的是算法的`计算操作数量`,而不是`运行的绝对时间`
- 计算操作数量和运行绝对时间呈正相关关系,并不相等。
- 算法运行时间受到编程语言、计算机处理器处理速度、运行环境等多种因素影响。
- 体现的是计算操作随数据大小N变化时的变化情况。

#### 1.2.1.1. 符号表示
根据输入数据的特点,时间复杂度具有`最差`,`平均`,`最佳`三种情况,分别使用`O``Θ``Ω` 三种符号来表示。

#### 1.2.1.2. 常见种类
根据从小到大排列,常见的算法时间复杂度主要有:
`O(1)<O(logN)<O(N)<O(NlogN)<O(N^2)<O(2^N)<O(N!)`

![时间复杂度常见种类](image-8.png)

#### 1.2.1.3. 常数阶O(1)
常数阶的操作数量与输入数据大小n无关,即不随着n的变化而变化。

```java
/* 常数阶 */
int constant(int n) {
int count = 0;
int size = 100000;
for (int i = 0; i < size; i++)
count++;
return count;
}
```

#### 1.2.1.4. 线性阶O(n)


### 1.2.2. 空间复杂度

0 comments on commit 6cfe4ad

Please sign in to comment.