Finding the function complexity index

吃可爱长大的小学妹 提交于 2019-12-23 16:04:06

问题


I have to find the complexity of a C file based on the number of lines. I have found the number of lines. But how to decide whether it is a complex file or not? Based on certain value, I have to give it an index. For eg., complexity index - 5 for high complexity. On which basis can I index it? More than 1000 lines for high complex, for eg., won't apply for all. Is there any standard way for giving conditions('more than 1000 lines')? Any kind of suggestions are welcome, except any pre-defined tools. I need to program it in C. Thanks in advance.


回答1:


comlexity is not based on lines, for example:

while(n!=0) {a+=b;n--;}

the complex is n and another exapmle:

for(i=0;i<n;i++) {for(j=0;j<n;j++) {a+=b} }

the complexity is n^2



来源:https://stackoverflow.com/questions/13950379/finding-the-function-complexity-index

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!