The big-O hierarchy for any constants a, b > 0 is; O(a) ⊂ O(log n) ⊂ O(n^b) ⊂ O(C^n).
对于任意常数a, b > 0是;O(1)⊂O(log n)⊂O(n ^ 2)⊂O(C ^ n)。
I need some explanations, thanks.
我需要一些解释,谢谢。
2 个解决方案
#1
1
Leading constants don't matter, so O(2n^2) = O(n^2)
and O(100 n log n) = O (n log n)
.
主要常数无关紧要,所以O(n ^ 2)= O(n ^ 2)和O(100 n O(log n))= O(n log n)。
If f
and g
are functions then O(f * g) = O(f) * O(g)
. Now, apparently you are ok accepting that O(log n) < O(n)
. Multiply both sides by O(n)
and you get O(n) * O(log n) = O(n * log n) < O(n * n) = O(n^2)
.
如果f和g是函数,那么O(f * g) = O(f) * O(g)。现在,显然你可以接受O(log n) < O(n)两边同时乘以O(n),得到O(n)* O(log n)= O(n * O(log n))< O(n * n)= O(n ^ 2)。
To see that O((log n)^3)
is less than O(n^a)
for any positive a
is a little trickier, but if you are willing to accept that O(log n)
is less than O(n^a)
for any positive a
, then you can see it by taking the third root of O((log n)^3)
and O(n^a)
. You get O(log n)
on the one side, and O(n^(a/3))
on the other side, and the inequality you are looking for is easy to deduce from this.
看到O(log n)^ 3)小于O(n ^)任何积极的有点棘手,但如果你愿意接受,O(log n)小于O(n ^)任何积极的一个,然后你能看到它通过第三根O((O(log n))^ 3)和O(n ^)。你得到O(log n)在一边,O(n (a/3))在另一边,你要找的不等式很容易推导出来。
#2
0
you can think about that number that a function produces, it usually goes that the smaller the number, the faster the algorithm is. And if it is a larger number the function produces its slower.
你可以考虑一个函数产生的那个数,它通常表示这个数越小,算法越快。如果它是一个较大的数,这个函数会产生它的慢。
log 10 < 10^b < C^n
日志10 < 10 b < C ^ ^ n
#1
1
Leading constants don't matter, so O(2n^2) = O(n^2)
and O(100 n log n) = O (n log n)
.
主要常数无关紧要,所以O(n ^ 2)= O(n ^ 2)和O(100 n O(log n))= O(n log n)。
If f
and g
are functions then O(f * g) = O(f) * O(g)
. Now, apparently you are ok accepting that O(log n) < O(n)
. Multiply both sides by O(n)
and you get O(n) * O(log n) = O(n * log n) < O(n * n) = O(n^2)
.
如果f和g是函数,那么O(f * g) = O(f) * O(g)。现在,显然你可以接受O(log n) < O(n)两边同时乘以O(n),得到O(n)* O(log n)= O(n * O(log n))< O(n * n)= O(n ^ 2)。
To see that O((log n)^3)
is less than O(n^a)
for any positive a
is a little trickier, but if you are willing to accept that O(log n)
is less than O(n^a)
for any positive a
, then you can see it by taking the third root of O((log n)^3)
and O(n^a)
. You get O(log n)
on the one side, and O(n^(a/3))
on the other side, and the inequality you are looking for is easy to deduce from this.
看到O(log n)^ 3)小于O(n ^)任何积极的有点棘手,但如果你愿意接受,O(log n)小于O(n ^)任何积极的一个,然后你能看到它通过第三根O((O(log n))^ 3)和O(n ^)。你得到O(log n)在一边,O(n (a/3))在另一边,你要找的不等式很容易推导出来。
#2
0
you can think about that number that a function produces, it usually goes that the smaller the number, the faster the algorithm is. And if it is a larger number the function produces its slower.
你可以考虑一个函数产生的那个数,它通常表示这个数越小,算法越快。如果它是一个较大的数,这个函数会产生它的慢。
log 10 < 10^b < C^n
日志10 < 10 b < C ^ ^ n