简体   繁体   English

渐近符号{O(f(n)}是算法可以拥有的最慢的运行时间吗?)

[英]isn't big Oh asymptotic notation {O(f(n)}the slowest runtime an algorithm can have?(it gives asymptotic upper bound which means slowest runtime)

i was reading a book called "Introduction to algorithms" and they were analyzing an algorithm called Strassen's algorithm for matrix multiplication and it said this- ""one might at first think that any matrix multiplication algorithm must take omega(n3)time, since the natural definition of matrix multiplication requires that many mul-tiplications. 我正在读一本叫做《算法简介》的书,他们正在分析一种称为Strassen矩阵乘法的算法,它说:“”一开始人们可能认为任何矩阵乘法算法都必须花费omega(n3)时间,因为矩阵乘法的自然定义要求进行多次乘法。 You would be incorrect, however: we have a way to multiply matrices in O(n3) time."" 但是,您可能是错误的:我们有一种方法可以在O(n3)时间内将矩阵相乘。”

isn't O(n3) time slower than omega(n3) time. O(n3)时间不比Omega(n3)时间慢。 as omega gives asymtotic lower bound means fastest runtime. 因为omega给出了渐近的下界,意味着运行时间最快。 than why the book say that we can do it in O(n3) like it is faster tha omega(n3) time. 而不是为什么书说我们可以像Omega(n3)那样更快地在O(n3)中做到这一点。

First of all it is not true that, as people commonly seem to believe, Big-O is worst case, Big-Omega is best case, and Big-Theta is average case. 首先,它是正确的,因为人们通常似乎认为,大O是最坏的情况下,大欧米茄是最好的情况下,和Big-θ是平均情况。

Big-O is an upper bound. Big-O是一个上限。 We are often interested in an upper bound on the worst case so Big-O gets associated with worst case behavior, but we can also be interested in an upper bound on average case behavior, etc. 我们通常对最坏情况的上限感兴趣,因此Big-O与最坏情况的行为相关联,但我们也可能对平均情况下的行为上限感兴趣,等等。

When we are using asymptotic notation applied to running times, "higher" functions are worse so upper bounds are good. 当我们将渐近符号应用到运行时间时,“较高”的函数会变差,因此上限越好。 If the algorithm has an upper bound, O(n^3), time this is better than it having a lower bound, Ω(n^3), because a lower bound means that it could be worse, could be slower, that it is no better than the lower bound. 如果算法的上限为O(n ^ 3),则此时间比下限为Ω(n ^ 3)更好,因为下限意味着它可能更糟,可能更慢,并不比下限更好。

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

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