1
yangff May 29, 2014 不存在。
|
2
misaka May 29, 2014 目测算法。。。
|
3
zhoulujue May 29, 2014
静态分析工具,多的是。
|
5
imxz May 29, 2014
是想问 大O 吗 ?
|
6
Mutoo May 29, 2014
大O表示法,在 Mark Allen Weiss 的《数据结构与算法分析》里面有专门一章节介绍,而且有好几章节的案例分析。
|
12
akfish May 29, 2014
|
13
akfish May 29, 2014 Mathematically, the cyclomatic complexity of a structured program[a] is defined with reference to the control flow graph of the program, a directed graph containing the basic blocks of the program, with an edge between two basic blocks if control may pass from the first to the second. The complexity M is then defined as[2]
M = E − N + 2P, where E = the number of edges of the graph. N = the number of nodes of the graph. P = the number of connected components (exit nodes). 够严谨了吧。 |
14
keniusahdu May 29, 2014 Sonar 有计算复杂度的。但是没有什么算法,都是针对循环,判断之类的识别。以及空引用高危判断。
ps:我说的是java ,其他不知道 |
15
fzss May 29, 2014
ORDER OF GROWTH
|
16
dorentus May 29, 2014 |
17
soundbbg May 29, 2014 一开始不需要过度优化,后面针对具体的瓶颈优化就好了。
拿循环做复杂度其实也挺逗的,谁知道函数嵌套了多少个函数,更不要说大部分不间断的程序都是死循环,你没看到只是因为别人都封装好了。 代码里不推荐多个嵌套循环这是必然的,但纯拿循环来说性能就和拿代码行数算KPI一个道理,况且计算机就是一个大循环。 |
18
ruandao May 29, 2014
时间复杂度?
空间复杂度? 还是逻辑复杂度? |
19
lijinma May 29, 2014
@soundbbg 拿循环说性能挺逗?大哥,那你觉得纯研究算法的是靠什么来做标准?还不是靠循环,你这是藐视算法分析;
一个算法在数据很小的时候没多大作用,但是在数据很大的时候,n^2 和 n 那得有多大差距啊; 敢问兄弟,不靠循环,你靠什么来评判一个算法的时间复杂度? |
23
karlxu OP @soundbbg 我们要用python做个统计代码复杂度的工具,难道就数if,while,for,try,catch,switch?会不会太简单了?
|
24
akfish May 30, 2014
@karlxu 正经的方法是把编译器前端部分做出来,解析源代码生成AST(抽象语法树),剩下的事情就是一堆图算法去撸而已。
这部分的研究很成熟了,各种IDE高上洋的代码自动完成、重构、分析工具都是这样实现的。 |
26
akfish May 30, 2014 |
27
wecing Jun 1, 2014
我只知道停机问题。
|