简体   繁体   English

算法的增长函数?

[英]Growth functions of Algorithm?

Well i have two questions here:- 我在这里有两个问题: -

  1. If f(n) is function whose growth rate is to be found then, Is for all three notations will the g(n) be same, like for f(n)=O(g(n)) and similaraly for omega and theta ? 如果f(n)是其生长速率可以找到的函数,则对于所有三种符号都是g(n)是相同的,如f(n)= O(g(n))和类似于omega和theta ?

  2. Theta notation is "omega and Oh" if in some case if oh and omega functions are different then, how will we find theta function there ? Theta表示法是“omega和Oh”,如果在某些情况下如果哦和欧米茄函数不同那么,我们如何在那里找到theta函数? Thanks :) 谢谢 :)

O, Θ and Ω notation represent related but very different concepts. O,Θ和Ω表示法表示相关但非常不同的概念。 O-notation expresses an asymptotic upper bound on the growth rate of a function; O符号表示函数增长率的渐近上界 ; it says that the function is eventually bounded from above by some constant multiple of some other function. 它说该函数最终被一些其他函数的某个常数倍所限制。 Ω notation is similar, but gives a lower bound. Ω表示法类似,但给出下限。 Θ notation gives an asymptotic tight bound - for sufficiently large inputs, the algorithm grows at a rate that is bounded from both above and below by a constant multiple of a function. Θ表示法给出渐近紧束缚 - 对于足够大的输入,算法以上下两个函数的常数倍的速率增长。

If f(n) = O(g(n)), it is not necessarily true that f(n) = Ω(g(n)) or that f(n) = Θ(g(n)). 如果F(N)= O(G(N)),它不一定是真实的F(N)=Ω(G(N)),或F(N)=Θ(G(N))。 For example, 1 = O(n), but 1 ≠ Ω(n) because n grows strictly faster than 1. 例如,1 = O(n),但是1≠Ω(n),因为n的生长严格快于1。

If you find that f(n) = O(g(n)) and Ω(h(n)), where g(n) ≠ h(n), you may have to do a more precise analysis to determine a function j(n) such that f(n) = Θ(j(n)). 如果发现f(n)= O(g(n))和Ω(h(n)),其中g(n)≠h(n),则可能需要进行更精确的分析以确定函数j (n)使得f(n)=Θ(j(n))。 If g(n) = Θ(h(n)), then you can conclude that f(n) = Θ(g(n)), but if the upper and lower bounds are different there is no mechanical way to determine the Θ growth rate of the function. 如果g(n)=Θ(h(n)),则可以得出结论f(n)=Θ(g(n)),但如果上限和下限不同,则没有机械方法来确定Θ功能的增长率。

Hope this helps! 希望这可以帮助!

f(n)=O(g(n)) means that n>N => |f(n)|≤C|g(n)| f(n)= O(g(n))表示n> N => | f(n)|≤C| g(n)| for some constants N and C. 对于一些常数N和C.

f(n)=Ω(g(n)) means that n>N => |f(n)|≥C|g(n)| f(n)=Ω(g(n))表示n> N => | f(n)|≥C| g(n)| for some constants N and C. 对于一些常数N和C.

f(n)=Θ(g(n)) means that f(n)=O(g(n)) and f(n)=Ω(g(n)). f(n)=Θ(g(n))表示f(n)= O(g(n)),f(n)=Ω(g(n))。

It is not possible for all f to find ag such that f(n)=Θ(g(n)) if we want g to be a "good" function (ie something like n^r*Log(n)^s). 如果我们想要g为“好”函数(即像n ^ r * Log(n)^ s这样的东西),那么所有f都不可能找到ag,使得f(n)=Θ(g(n)) 。 For instance, if f(n)=cos(n)²*n+sin(n)²*n², we have f(n)=O(n²) and f(n)=Ω(n) but we can't find a "good" g such that f(n)=Θ(g(n)). 例如,如果f(n)= cos(n)²* n + sin(n)²*n²,我们有f(n)= O(n²)和f(n)=Ω(n)但我们可以'找到“好”g使得f(n)=Θ(g(n))。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM