O Notation
This question already has an answer here:
Keep it simple!
Just think of the Big-O as a way to express the performance of the algorythm. That performance will depend on the number of elements the algorythm is handeling = n.
An example, when you have to make a sum. You need one statement for the first addition, one statement for the second addition, and so on... So the performance will be linear with the number of elements = O(n).
Imagine a sort algorythm, which is very smart, and for each element of handles it automatically shortens the sort for the next element. This will be logarithmic with the number of elements = O(log(n)).
Or a complex formula with parameters, and with each extra parameter, the execution time multiplies. This will be exponential = O(10^n).
链接地址: http://www.djcxy.com/p/39656.html上一篇: 了解摊销时间和为什么数组插入是O(1)
下一篇: O符号