符号定义

描述算法效率的符号说明。

Big-O(O)

求在最坏情况下的算法的时间复杂度,即复杂度(函数增长速度)的上界。

Big-Omega(Ω)

求在最好情况下的算法的时间复杂度,即复杂度(函数增长速度)的下界。

Big-Theta(Θ)

求算法的平均时间复杂度

Little-O()

与Big-O的差别是不含下边界

Little-Omega()

与Big-Omega的差别是不含上边界

O(n) means,

For at least one choice of a constant k > 0, you can find a constant a such that the inequality 0 <= f(x)<= k g(x) holds for all x > a.

o(n) means,

For every choice of a constant k > 0, you can find a constant a such that the inequality 0 <= f(x)< k g(x) holds for all x > a.

--------------------------------------------------

f  =  Ο(g) =====f≤g  
f  =  Ω(g) =====f≥g  
f  =  θ(g) =====f=g  
f  =  o(g) =====f<g  
f  =  ω(g) =====f>g  

----------------------------------------------------

复杂度优劣比较

好----->不好

常数>对数>线性>nlogn>平方>立方>指数>阶乘

 

 

算法复杂度&Big-O表示法

算法复杂度

---------------------------------------

这人说是面试的时候经常被问到(看来国内外是一样的哇),所以干脆搞了一个“小抄”造福大家。。

网站的链接我会附在最后

---------------------------------------

算法复杂度&Big-O表示法

 

算法复杂度&Big-O表示法


图片来源:

http://bigocheatsheet.com/

参考博文:

https://blog.csdn.net/xiaofei0859/article/details/77074028

相关文章:

  • 2021-04-25
  • 2022-12-23
  • 2021-09-14
  • 2022-12-23
  • 2022-12-23
  • 2021-10-27
  • 2022-02-10
  • 2021-09-26
猜你喜欢
  • 2021-07-10
  • 2022-01-05
  • 2021-11-26
  • 2021-12-09
  • 2022-01-16
  • 2021-12-29
  • 2021-04-18
相关资源
相似解决方案