最慢的计算复杂度(Big

编程入门 行业动态 更新时间:2024-10-24 04:42:02
本文介绍了最慢的计算复杂度(Big-O)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

超出这些算法,我知道Alg1是最快的,因为它是n平方。接下来是Alg4,因为它是n立方,然后Alg2可能是最慢的,因为它是2 ^ n(应该是性能很差)。

但是在速度方面,我还没有遇到过Alg3和Alg5。这两种算法在快慢方面如何与其他3种相比呢?谢谢您的帮助。

编辑:现在我想到了,Alg3是指O(n log n)吗?如果其中的ln表示'log',则将使其成为最快的。

解决方案

升序为: 。

Out of these algorithms, I know Alg1 is the fastest, since it is n squared. Next would be Alg4 since it is n cubed, and then Alg2 is probably the slowest since it is 2^n (which is supposed to have a very poor performance).

However Alg3 and Alg5 are something I have yet to come across in my reading in terms of speed. How do these two algorithms rank up to the other 3 in terms of which is faster and slower? Thanks for any help.

Edit: Now that I think about it, is Alg3 referring to O(n log n)? If the ln inside of it means 'log', then that would make it the fastest.

解决方案

The ascending order would be: n·log(n) < n2 < n3 < 2n < n! for n ≥ 10.

Also have a look at the Big-O Algorithm Complexity Cheat Sheet.

更多推荐

最慢的计算复杂度(Big

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

发布评论

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

>www.elefans.com

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