This paper presents a new algorithm for calculating the reliability of the binary coherent and non-coherent network system. It depends on Boolean function algorithm and Shannon's expansion form. Following the input terms by SDP form, we will get the Boolean function of the fewest SDP terms by choosing adequate variable X (subscript i) or (average)X(subscript i). While all the algorithms published to date, only apply for coherent system, the algorithm of this paper applies for not only coherent system but also non-coherent system. We also designed a program to proceed this algorithm. Finally, we listed ten examples. First to fifth examples are binary coherent system, in which we compared both SDP terms obtained by the algorithm of this paper and that of SLR. Last five examples are binary non-coherent systems, we found in which its fewest SDP terms and reliability.