解释多变量大符号(Interpreting multivariate big

编程入门 行业动态 更新时间:2024-10-26 14:28:22
解释多变量大符号(Interpreting multivariate big-Oh notation)

我正在处理一种情况,我现在有一个算法,其复杂性由三个独立变量l , m和n 。 算法的一个实现在O((l + m)*log^2(l + m) + (m + n)*log^2(m + n))时间运行,另一个在O((l + m + n)*log^2(l + m + n)) 。 我怎样才能解释这些复杂性? 哪一个会更受欢迎? 一般来说,如果f和g是n变量的函数,我怎样才能确定O(f)是否比O(g)更渐近?

I'm dealing with a situation right now where I have an algorithm whose complexity is determined by three independent variables l, m, and n. One implementation of the algorithm runs in O((l + m)*log^2(l + m) + (m + n)*log^2(m + n)) time and another runs in O((l + m + n)*log^2(l + m + n)). How can I interpret these complexities? Which one would be preferred? In general, if f and g are functions of n variables, how can I determine if O(f) is better asymptotically than O(g)?

最满意答案

如何判断O(f)是否比O(g)更渐近?

这取决于f和g之间的关系,即它取决于调用者使用的实际参数。 换句话说,如果不扩大其范围,就无法回答这个问题。

如果你对值的行为有隐含的知识(例如,如果值绑定在大小上相互关联),你可以将它们等同,例如用x替换它们。

如果决定对您有实际意义,我建议您实施两种算法并在实践中尝试将其包含在执行时间的常数因素上。

how can I determine if O(f) is better asymptotically than O(g)?

That depends on the relation between f and g, i.e. it depends on what actual arguments the caller uses. It's in other words impossible to answer the question without widening the scope of it.

If you have implicit knowledge of the behavior of the values (for instance if the values are bound to follow each other in magnitude) you could equate them and for instance replace them with x.

If the decision has practical implications for you I suggest you implement both algorithms and try them out in practice to include the constant factors on the execution time.

更多推荐

本文发布于:2023-04-29 07:23:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1335868.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:量大   多变   符号   big   multivariate

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!