算法空间/时间复杂度:修订间差异

来自康健生活
Kangkk​(留言 | 贡献)
Kangkk​(留言 | 贡献)
 
第12行: 第12行:


<pre>Plot[{1, Log[x], x, x*Log[x], x^2, x^3, 2^x, x!}, {x, -30, 30}, PlotLegends -> "Expressions"]</pre>
<pre>Plot[{1, Log[x], x, x*Log[x], x^2, x^3, 2^x, x!}, {x, -30, 30}, PlotLegends -> "Expressions"]</pre>
[[文件:时间复杂度-1.png|400px|无|时间复杂度-1]]

2026年2月1日 (日) 16:28的最新版本

常用的时间复杂度量级

  • 常数阶 O(1)
  • 对数阶 O(log⁡n)
  • 线性阶 O(N)
  • 线性对数阶 O(n×log⁡n)
  • 平方阶 O(n2)
  • 立方阶 O(n3)
  • K 次立方阶 O(nk)
  • 指数阶 O(2n)
  • 乘阶 O(n!)


Plot[{1, Log[x], x, x*Log[x], x^2, x^3, 2^x, x!}, {x, -30, 30}, PlotLegends -> "Expressions"]
时间复杂度-1
时间复杂度-1