为什么程序员美元,而不是Øp $ PFER O(N ^ 3)(N ^ 2) [英] Why a programmer would prefer O(N^3) instead of O(N^2)
本文介绍了为什么程序员美元,而不是Øp $ PFER O(N ^ 3)(N ^ 2)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在攻读我的期末考试,有一个问题,在档案中,我无法找到它的答案是:
中的一个算法的运行时间的增长阶为O(N ^ 2);该 订单的生长的第二算法的运行时间为O(N ^ 3)。名单 3引人注目的(逻辑,令人信服的)理由程序员会 preFER使用O(N ^ 3)的算法,而不是O(N ^ 2)之一。
解决方案
我能想到的有以下三个原因:
- 易于首次执行。
- 易于日后的维护中。
- 的O(N ^ 3)算法可能比Ø较低的空间复杂度(N ^ 2)算法(即,它使用较少的内存)。
I was studying for my final exam and there is a question in the archive that I cannot find its answer:
The order-of-growth of the running time of one algorithm is O(N^2); the order-of-growth of the running time of a second algorithm is O(N^3). List three compelling (logical, convincing) reasons why a programmer would prefer to use the O(N^3) algorithm instead of the O(N^2) one.
解决方案
I can think of the following three reasons:
- Ease of initial implementation.
- Ease of maintenance in the future.
- The O(N^3) algorithm may have a lower space complexity than the O(N^2) algorithm (i.e., it uses less memory).
这篇关于为什么程序员美元,而不是Øp $ PFER O(N ^ 3)(N ^ 2)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文