当前位置:网站首页>时间复杂度和空间复杂度
时间复杂度和空间复杂度
2022-08-05 05:19:00 【CrazyQiQi】
时间复杂度和空间复杂度
1. 算法的时间复杂度
概念:进行算法分析时,语句总的执行次数 T(n) 关于问题规模 n 的函数,进而分析 T(n) 随 n 的变化并确定 T(n) 的数量级。
公式:T(n)=O(f(n)),f(n) 是问题规模 n 的某个函数
常见的时间复杂度
| 例子 | 时间复杂度 | 术语 |
|---|---|---|
| 5201314 | O(1) | 常数阶 |
| 3n+4 | O(n) | 线性阶 |
| 3n^2+4 | O(n^2) | 平方阶 |
| 3log(2)n+4 | O(logn) | 对数阶 |
| 2n+3nlog(2)n+4 | O(nlogn) | nlogn阶 |
| n3+2n2+4n+3 | O(n^3) | 立方阶 |
| 2^n | O(2^n) | 指数阶 |
常用时间复杂度所耗费的时间
2. 算法的空间复杂度
概念:算法的空间复杂度通过计算算法所需的存储空间实现
计算公式:S(n) = O(f(n)),其中,n 为问题规模,f(n) 为语句关于 n 所占存储空间的函数
边栏推荐
- D45_摄像机组件Camera
- 每日一题-两数相加-0711
- Spark source code-task submission process-6.1-sparkContext initialization-create spark driver side execution environment SparkEnv
- 入门文档03 区分开发与生产环境(生产环境才执行‘热更新’)
- 【Day8】使用LVM扩容所涉及的命令
- Getting Started 11 Automatically add version numbers
- Apache configure reverse proxy
- 偷题——腾讯游戏开发面试问题及解答
- 账号与权限管理
- UE4动画雨滴材质制作教程
猜你喜欢

【机器学习】1单变量线性回归

lvm logical volume and disk quota

Unity常用模块设计 : Unity游戏排行榜的制作与优化

UE5再次更新!扫描或手动建模面部模型可直接转为绑定好的Metahuman
![[Day1] VMware software installation](/img/24/20cc77e904dbe7dc1b5224c64d6329.png)
[Day1] VMware software installation
![[Paper Intensive Reading] Rich Feature Hierarchies for Accurate Object Detection and Semantic Segmentation (R-CNN)](/img/a7/fc3fe440f5e57362d44ae875b7d436.png)
[Paper Intensive Reading] Rich Feature Hierarchies for Accurate Object Detection and Semantic Segmentation (R-CNN)

云游戏未来展望

如何使用Houdini进行程序化优化?

“元宇宙”是个啥?都有哪些大招?

Getting Started Doc 06 Adding files to a stream
随机推荐
硬盘分区和永久挂载
入门文档07 分阶段输出
Apache configure reverse proxy
The problem of redirecting to the home page when visiting a new page in dsf5.0
The spark operator - coalesce operator
每日一题-两数相加-0711
【Day8】使用LVM扩容所涉及的命令
Getting Started 03 Distinguish between development and production environments ("hot update" is performed only in the production environment)
Getting Started 04 When a task depends on another task, it needs to be executed in sequence
Three modes of vim
spark源码-任务提交流程之-5-CoarseGrainedExecutorBackend
小度 小度 在呢!
spark source code - task submission process - 2-YarnClusterApplication
Getting Started 05 Using cb() to indicate that the current task is complete
D39_向量
Cocos Creator开发中的事件响应
入门文档04 一个任务依赖另外一个任务时,需要按顺序执行
入门文档09 独立的watch
The problem of calling ds18b20 through a single bus
游戏引擎除了开发游戏还能做什么?