question archive Calculate Halstead’s basic measures on the factorial code given below: intfact(intn) { if(n == 0 ) { return1;} else } { return n * fact (n-1) ; } operators: int 2; ( ) 3; { } 3; if 1; == 1; return 2; ‘‘;’’ 2; else 1; * 1; —1 operands: fact 2; n 4; 0 1; 1 2; basic counts 11 = 10 12 = 4 1 = 14 12* = 1 N1 = 17 N2 = 9 N = 26 Est N = 10 * log2 10 + 4 * log2 4 = 10 * 3
Subject:Computer SciencePrice: Bought3
Calculate Halstead’s basic measures on the factorial code given below:
intfact(intn) {
if(n == 0 )
{ return1;}
else
}
{ return n * fact (n-1) ; }
operators: int 2; ( ) 3; { } 3; if 1; == 1; return 2; ‘‘;’’ 2; else 1; * 1; —1
operands: fact 2; n 4; 0 1; 1 2; basic counts
11 = 10 12 = 4 1 = 14 12* = 1
N1 = 17 N2 = 9 N = 26
Est N = 10 * log2 10 + 4 * log2 4 = 10 * 3.32 + 4 * 2.0 = 33.2+ 8.0 = 41.2
V = 26 * log2 14 = 26 * 3.8 = 98.8
V* = 3 log2 3 = 3 * 1.6 = 4.8
L = 4.8 / 98.8 = 0.048