In computer science, the time complexity of an algorithm quantifies the amount of time taken by an algorithm to run as a function of the size of the input to the problem. The time complexity of an al……
[/Quote]
有点像求极限。
In computer science, the time complexity of an algorithm quantifies the amount of time taken by an algorithm to run as a function of the size of the input to the problem. The time complexity of an algorithm is commonly expressed using big O notation, which suppresses multiplicative constants and lower order terms. When expressed this way, the time complexity is said to be described asymptotically, i.e., as the input size goes to infinity. For example, if the time required by an algorithm on all inputs of size n is at most 5n3 + 3n, the asymptotic time complexity is O(n3).
这种表示算法时间复杂度的方法叫big O notation,表示一个算法所用的时间量
它是舍弃了倍系数和低位项,因此此种表示法被称为近似描述(asymptotically)
因为输入大小可以接近无限
比如5n3 + 3n
就是O(n3),是舍弃了乘系数5和低位项3n