首页 > 解决方案 > NLOC and Complexity numbers during Code Analysis

问题描述

I wrote a code for constructing an expression tree and traversing the tree in three different ways
a) Inorder traversal
b) Postorder Traversal
c) Level order Traversal

So, I wanted to know the complexity of my code and found this website which calculates it:
[ http://www.lizard.ws/ ]

These were the results:

Function Name       NLOC      Complexity     Token #    Parameter #  

faw                  10         6             51    
push                 12         2             61    
pushp                12         2             61    
pop                   5         1             25    
popp                  5         1             25    
inorder               9         2             38    
postorder             9         2             38    
printLevelOrder       7         2             40    
printLevel           12         4             66    
height               15         3             76    
main                 100        21           738

Question: What does NLOC and the numbers for complexity denote? Does having a high number mean, the code isn't well optimized?

标签: c++14

解决方案


NLOC表示代码行数。例如这里针对push函数的值为12,NLOC告诉我们函数的大小。复杂度列表示每个函数代码的复杂度。


推荐阅读