As the title say: I don't know the meaning of "complexity"
When I visit a web page of sonar result I would very much want to know how to calculate it.
As the title say: I don't know the meaning of "complexity"
When I visit a web page of sonar result I would very much want to know how to calculate it.
Definition of complexity on wikipedia here.
Complexity basically means how many actions your program performs proportional to the input. Usually it's calculated from your loops or the depth of your recursive functions.
Examples:
This has a complexity of O(n) because the actions in the for-loop are executed n times.
for (int i = 0 ; i < n ; ++i)
This has a complexity of O(n^2)
for (int i = 0 ; i < n ; ++i)
for (int j = 0 ; j < n ; ++j)
This also has a complexity of O(n):
void recursion (int level, int n) {
if (level < n)
recursion(level + 1, n);
}
Update:
Reading your comment, I think you're referring to Cyclomatic complexity, you can read about it here.There's a fairly good explanation in the Description section, but to be honest, I've never used / heard of this kind of complexity.