当前位置:网站首页>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
边栏推荐
- spark算子-coalesce算子
- LinkSLA坚持用户第一,打造可持续的运维服务方案
- spark operator-wholeTextFiles operator
- Why can't I add a new hard disk to scan?How to solve?
- Getting Started Document 07 Staged Output
- Spark source code-task submission process-6.1-sparkContext initialization-create spark driver side execution environment SparkEnv
- spark operator-textFile operator
- [Day5] Soft and hard links File storage, deletion, directory management commands
- LeetCode面试题
- 正则表达式小实例--验证邮箱地址
猜你喜欢
随机推荐
Image compression failure problem
TCP/IP四层模型
Configuration of TensorFlow ObjecDetectionAPI under Anaconda3 of win10 system
Wireshark抓包及常用过滤方法
ROS video tutorial
Autoware中安装Yolo3目标检测模块遇到的问题
有哪些事情是你做了运维才知道的?
Small example of regular expression--remove spaces in the middle and on both sides of the string
不吹不黑,这的确是我看过微服务架构最好的文章!
【Day1】(超详细步骤)构建软RAID磁盘阵列
Getting Started 11 Automatically add version numbers
ROS视频教程
线上问题排查流程
Technology Sharing Miscellaneous Technologies
Getting Started Document 09 Standalone watch
Transport layer protocol (TCP 3-way handshake)
Mongodb查询分析器解析
入门文档01 series按顺序执行
[Day1] VMware software installation
Introductory document 05-2 use return instructions the current task has been completed









