gpt4 book ai didi

algorithm - 为什么程序员更喜欢 O(N^3) 而不是 O(N^2)

转载 作者:塔克拉玛干 更新时间:2023-11-03 02:14:44 24 4
gpt4 key购买 nike

我正在为期末考试复习,存档中有一个问题我找不到它的答案:

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.

最佳答案

我可以想到以下三个原因:

  • 易于初始实现。
  • 便于日后维护。
  • O(N^3) 算法的空间复杂度可能低于 O(N^2) 算法(即,它使用的内存更少)。

关于algorithm - 为什么程序员更喜欢 O(N^3) 而不是 O(N^2),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21068930/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com