问题描述
如何决定算法的前pressing时间复杂度?
How to decide on expressing time complexity of algorithm ?
如果我们选择EX preSS的时间复杂度 O(N)
或 THETA(N)$ C $的条款C>?因为一个函数
F(N)
可以pssed因为无论是大哦(G(N))
或 THETA(G(N))
。
Should we choose to express time complexity in terms of O(n)
or theta(n)
? Because a function f(n)
can be expressed as either Big-Oh(g(n))
or theta (g(n))
.
我们什么时候选择大哦了THETA?
When do we choose big-oh over theta ?
推荐答案
当你要同时指定一个下界使用大西塔符号。 F(N)= O(G(N))
表示, F
上面用先按g ,而 F(N)=西塔(G(N))
表示, F
是先按g
界的上方和下方。
Use Big Theta notation when you want to also specify a lower bound. f(n) = O(g(n))
says that f
is bounded above by g
, whereas f(n) = Theta(g(n))
says that f
is bounded both above and below by g
.
在换句话说,有常数 K1
和 2
,使得 K1 * | G(N)| < = | F(N)| < = K2 * | G(N)|
In other words, there are constants k1
and k2
such that k1 * |g(n)| <= |f(n)| <= k2 * |g(n)|
这篇关于困惑于是否EX preSS与THETA符号或大哦符号的时间复杂度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!