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