更改

跳到导航 跳到搜索
添加11字节 、 2020年9月12日 (六) 09:43
第642行: 第642行:       −
==Constant factors==
+
==常数因子 Constant factors==
    
Analysis of algorithms typically focuses on the asymptotic performance, particularly at the elementary level, but in practical applications constant factors are important, and real-world data is in practice always limited in size. The limit is typically the size of addressable memory, so on 32-bit machines 2<sup>32</sup> = 4 GiB (greater if [[segmented memory]] is used) and on 64-bit machines 2<sup>64</sup> = 16 EiB. Thus given a limited size, an order of growth (time or space) can be replaced by a constant factor, and in this sense all practical algorithms are O(1) for a large enough constant, or for small enough data.
 
Analysis of algorithms typically focuses on the asymptotic performance, particularly at the elementary level, but in practical applications constant factors are important, and real-world data is in practice always limited in size. The limit is typically the size of addressable memory, so on 32-bit machines 2<sup>32</sup> = 4 GiB (greater if [[segmented memory]] is used) and on 64-bit machines 2<sup>64</sup> = 16 EiB. Thus given a limited size, an order of growth (time or space) can be replaced by a constant factor, and in this sense all practical algorithms are O(1) for a large enough constant, or for small enough data.
第665行: 第665行:     
对于大数据不能忽略线性因子或二次因子,但对于小数据,渐近低效算法可能更有效。这在混合算法中尤其常用,比如 Timsort,它使用一种渐近有效的算法(在这里使用合并排序,时间复杂度数学 n  log n / math) ,但是对于小数据切换到一种渐近低效的算法(在这里使用插入排序,时间复杂度数学 n ^ 2 / math) ,因为更简单的算法在小数据上更快。
 
对于大数据不能忽略线性因子或二次因子,但对于小数据,渐近低效算法可能更有效。这在混合算法中尤其常用,比如 Timsort,它使用一种渐近有效的算法(在这里使用合并排序,时间复杂度数学 n  log n / math) ,但是对于小数据切换到一种渐近低效的算法(在这里使用插入排序,时间复杂度数学 n ^ 2 / math) ,因为更简单的算法在小数据上更快。
  −
      
==See also==
 
==See also==
463

个编辑

导航菜单