Operator |
Frequency |
---|
if |
1 |
* |
6 |
== |
1 |
return |
2 |
= |
3 |
Number of unique operators (n1) = 5
Number of operators (N1) = 13
Operand |
Frequency |
---|
temp |
2 |
A1 |
3 |
A2 |
3 |
Number of unique operands (n2) = 3
Number of operands (N2) = 8
N = N1+N2 = 8 + 13 = 21
n = n1+n2 = 5 + 3 = 8
Program Volume (V) = N log2 n
= 21 log28
= 21*3 = 63
Program Difficulty (D) = n1/2 * (N2/n2)
= 5/2 * 8/3
=20/3
Program Effort (E) = D * V
= 20/3 * 63
= 420
[float, ; and () are not considered as operators here while many places they are also considered]