算法空间/时间复杂度

来自康健生活

常用的时间复杂度量级

  • 常数阶 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