• It is introduced by M.H.Halsted in 1977.

  • Halsted science is an estimation technique to find out the size, time, and effort of a software.
  • Halstead complexity is based upon counts of operators and operands. The operators are:- if, ( , ) , { , } , = , + , - , * , ; , etc. And, the operands are x , k , 3 , 2 ,4 , or we can say that the value we take in the program.
  • The number of unique operators and operands(  Î·1  and  η2 ) as well as the total number of operators and operator ( Nand N2 ). 
  • η1 is the number of distinct operators.
  • η1 is the number of distinct operands.
  • N1 total occurrences of operators.
  • N2 total occurrences of operands.

From this number, the following measures can be calculated:-


1.  Program length (N)

  
Program length (N) =   N + N2   

2.   Vocabulary size (η)


Vocabulary size (η) = Î·1  +  η2

3.  Program volume (V)


Program volume(V) = N * log2   Î·

4.  Difficulty level (D)


Difficulty level (D) =  Î·1 /2 *  N2  /  Î·2

Difficulty level (D) = Î·1 *  N2  /  Î·2 * N


5.  Program level (L)


Program level (L) = 1/D

6.  Effort to implement (E)


Effort to implementation (E) = V * D

7.  Estimated program length 


Estimated program length =  Î·1 log2 Î·1 +  Î·log2  Î·1


8.  Potential volume ( V )


  
Potential volume ( V ) = (2 +   Î·2* )log  ( 2 +  Î·2*  )


9.  Estimated program level/difficulty ( L )



Estimated program level/difficulty ( V ) = 2  Î·2   /  Î·1N2


10.  Effort ( E )



Effort ( E ) =  V  / L = V * D


11.  Time to implement ( T )



Time to implement ( T ) = E / Î²


ADVANTAGE 

  • It is simple to calculate.
  • It is useful in scheduling projects.
  • It measures the overall quality of programs.
  • It can be used for any programming language.
  • It predicts ( see ) effort and time.
  • UT predicts ( see ) the rate of error.

DISADVANTAGE


  • It depends on the usage of operators and operands in the completed code.