美文网首页
Halstead 复杂度

Halstead 复杂度

作者: Nino_Lau | 来源:发表于2019-04-21 20:02 被阅读0次

    计算下列代码片段的 Halstead 复杂度的 11 项内容。

    image
    Operator Number of Occurrences Operand Number of Occurrences
    If 1 month 3
    < 1 year 5
    += 1 dayray 1
    - 1 day 1
    + 6 3 1
    * 2 12 1
    / 4 1 1
    % 1 26 1
    n1 = 8 N1 = 17 10 1
    4 1
    6 1
    100 1
    400 1
    7 1
    n2 = 14 N2 = 20

    • n1 = 8, n2 = 14, N1 = 17, N2 = 20
    • Program vocabulary: n = n1 + n2 = 22
    • Program length: N = N1 + N2 = 37
    • Program volume: V = Nlog2(n) = 164.9978
    • Program level: L^ = (2/n1) * (n2/N2) = 0.175
    • Program difficulty: D = 1/L^ = 5.7143
    • Program Effort: E = V * D = V/L^ = 942.8446
    • Language level: Lʹ = L^ \* L^* V = 5.0531
    • Program Time(hours): T^ = E/(S * f) = 0.0145
    • 平均语句大小: N/语句数 = 9.25
    • 程序中的错误数预测值:
    • B = V/3000 = Nlog2(n)/3000 = 0.0550

    相关文章

      网友评论

          本文标题:Halstead 复杂度

          本文链接:https://www.haomeiwen.com/subject/ouajgqtx.html