如何证明Big O符号

编程入门 行业动态 更新时间:2024-10-26 06:32:04
本文介绍了如何证明Big O符号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

在我的算法课程中,我们正在讨论大O表示法,但我坚持证明了这个示例问题:

In my algorithm class we are discussing big O notation and I am stuck proving this example problem:

证明f(n) = 3n lg n + 10n + lg n + 20 = O(n lg n)

详细信息将不胜感激.

推荐答案

Big O表示法是渐近表示法,它全都与案件的近似值(最差,最佳和中级)有关. 在您的示例中,nlgn的增长速度快于n和lgn,而且常量值无关紧要,因此可以近似地忽略. 因此,其复杂度为O(nlgn).

Big O notation is an asymptotic notation and it's all about approximation of cases (worst, best and mid one). In your example, nlgn grows faster than both n and lgn, moreover constant values are not relevant and can be ignored in such an approximation. Because of that, it follows that the complexity is O(nlgn).

更多推荐

如何证明Big O符号

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

发布评论

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

>www.elefans.com

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