当前位置:网站首页>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
边栏推荐
猜你喜欢
vim的三种模式
[Day5] Soft and hard links File storage, deletion, directory management commands
解决这三大问题,运维效率将超90%的医院
IP address and subnet division
spark source code-RPC communication mechanism
IJCAI 2022|Boundary-Guided Camouflage Object Detection Model BGNet
入职前,没想到他们玩的这么花
dsf5.0 弹框点确定没有返回值的问题
Getting Started Documentation 12 webserve + Hot Updates
【Day8】使用LVM扩容所涉及的命令
随机推荐
RAID磁盘阵列
spark source code - task submission process - 5-CoarseGrainedExecutorBackend
技术分享杂七杂八技术
微信小程序页面跳转传参
Spark source code-task submission process-6.2-sparkContext initialization-TaskScheduler task scheduler
The problem of calling ds18b20 through a single bus
网络布线与数制转换
Mongodb查询分析器解析
Technology Sharing Miscellaneous Technologies
TCP/IP four-layer model
【Day8】Knowledge about disk and disk partition
正则表达式小示例--获取重复最多的字符及其数量
spark operator-wholeTextFiles operator
ROS video tutorial
NIO works is analysed
解决这三大问题,运维效率将超90%的医院
Spark source code - task submission process - 6-sparkContext initialization
智能运维会取代人工运维吗?
正则表达式小实例--去掉字符串中间和两边的空格
[Day1] (Super detailed steps) Build a soft RAID disk array