当前位置:网站首页>time complexity and space complexity
time complexity and space complexity
2022-08-05 06:14:00 【CrazyQiQi】
Time and space complexity
1. Time complexity of the algorithm
Concept: When performing algorithm analysis, the total number of executions of the statement T(n) is a function of the problem size n, and then analyze the change of T(n) with n and determine the order of magnitude of T(n).
Formula: T(n)=O(f(n)), f(n) is some function of problem size n
Common time complexity
| Example | Time Complexity | Terms |
|---|---|---|
| 5201314 | O(1) | Constant order |
| 3n+4 | O(n) | Linear order |
| 3n^2+4 | O(n^2) | Square order |
| 3log(2)n+4 | O(logn) | Logarithmic |
| 2n+3nlog(2)n+4 | O(nlogn) | nlogn order |
| n3+2n2+4n+3 | O(n^3) | Cubic order |
| 2^n | O(2^n) | Exponential order |
Time spent in common time complexity
2. Space complexity of the algorithm
Concept: The space complexity of the algorithm is realized by calculating the storage space required by the algorithm
Calculation formula: S(n) = O(f(n)), where n is the problem size and f(n) isStatement about the function of the storage space occupied by n
边栏推荐
猜你喜欢
随机推荐
unity实现第一人称漫游(保姆级教程)
[Pytorch study notes] 8. How to use WeightedRandomSampler (weight sampler) when the training category is unbalanced data
dsf5.0 弹框点确定没有返回值的问题
ROS video tutorial
spark源码-任务提交流程之-7-流程梳理总结
spark operator-textFile operator
I217-V network disconnection problem in large traffic under openwrt soft routing
SSL证书提示过期或者无效,该怎么处理呢?
千亿IT运维市场,产品要凭实力说话
【机器学习】1单变量线性回归
Autoware--北科天绘rfans激光雷达使用相机&激光雷达联合标定文件验证点云图像融合效果
智能运维会取代人工运维吗?
PVE 直通硬盘到TrueNAS
Spark source code-task submission process-6.2-sparkContext initialization-TaskScheduler task scheduler
VLAN详解及实验
ROS视频教程
spark算子-map vs mapPartitions算子
Getting Started 05 Using cb() to indicate that the current task is complete
Spark源码-任务提交流程之-6-sparkContext初始化
【Day1】VMware软件安装




![[Day8] (Super detailed steps) Use LVM to expand capacity](/img/ff/d4f06d8b30148496da64360268cf1b.png)



